SAS数据分析巧用循环使用技巧

本文深入探讨了在SAS数据分析中如何巧妙运用循环技术,包括DO loops, WHILE loops和PROC步的使用,旨在提高效率并解决复杂问题。通过实例解析,展示了循环在大数据处理、统计建模和报告生成等场景下的实用技巧。" 83032768,7529967,MySQL数据库中文乱码解决方案及常用SQL操作,"['数据库管理', 'MySQL', 'SQL', '字符编码']
摘要由CSDN通过智能技术生成
data _null_;
n=4;
do;
	put "hello world";
	n=n+2;
end;
if mod(n,2)=0 then 
do;
	sum+n;
	put n=;
	end;
run;
data _null_;
x=rand('normal');
ispositive=0;
if x>=0 then ispositive=1;
put x= ispositive=;
run;

data _null_;
x=rand('bernouli',0.5);
if x=1 then do;
	isup=1;
	put "硬币国徽朝上 " isup=;
	end;
else do;
	isup=0;
	put "硬币国徽朝下 " isup=;
	end;
run;
data myclass;
set sashelp.class;
if age>13;
run;
proc print data=myclass;
run;
data _null_;
x=ceil(rand("uniform")*6);
put "x=" x;
select(x);
	when (1) put "1";
	when (2) put "2";
	otherwise put "*****";
	end;
run;
data _null_;
array myarray [5] _temporary_ (1,2,3,4,5);
do i=1 to dim(myarray) by 2;
put myarray[i] @@;
end;
run;
data _null_;
sum=0;
n=1;
do while(n<=100);
	sum=sum+n;
	put n= sum
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值