⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 do_loops.sas

📁 本书详细讲解了sas的使用基础以及编程基础
💻 SAS
字号:
Data a;
do i=0 to 9;
	put i;		* Put语句:将变量值显示在日志窗口;
end;
run;

Data a;
Do I = 1 to 9;		* 被乘数从 1 循环到 9 ;
	Do j = 1 to I;		* 乘数从 1 循环到被乘数 ;
		S = I * j;
		Put  I  '*'  j  '='  S  ' ' @@; * @@表示输出后不换行 ;
		*output;
	End ;
	Put;		* Put 语句使输出完一个被乘数后换行 ;
End;
Run;

data blah;
	do id = 101 to 107 by 2;
  		input thescore @@; 
		output; 
	end;
datalines;
12 95 73 0
;
run;

data epi999;
	do thegrade = 'A', 'B', 'C', 'D', 'F';
	    input thescore @@; output; 
	end;
datalines;
2 5 12 3 1
;
run;
data x;
  sum=0;
  t=1;
  do while (t<=100);
	   sum=sum+t;
	   t=t+1;
	   output;
  end;
run;

data x;
  sum=0;
  t=1;
  do while (1=1);
	   sum=sum+t;
	   t=t+1;
       output;
	   if t>100 then leave;   
  end;
run;

data table2_4;
	format income $10. satis $5.;
	do income = "lt6", "six", "fifteen", "twentyfive";
		do satis = "vd", "ld", "ms", "vs";
			input theWeight @@ ;
			output;
		end;
	end;
datalines;
	20 24  80  82
	22 38 104 125
	13 28  81 113
	 7 18  54  92
;run;
proc freq data = table2_4;
	weight theWeight;
	tables income*satis/nocol norow nopercent;
run;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -