一个简单例子,你可以自己稍微处理下。
/* if then*/
data tmp(drop=a);
input a;
if missing(a) then nmiss_a+1;
datalines;
1
1
.
1
.
1
;
/*nmiss*/
proc means data=tmp nmiss;
var a;
run;
SAS functions operate on rows. You can use proc means to have a simple statistics for all USEFUL numerc variables.
data t1;
r=0.1;
do i=1 to 100;
x=rannor(123); x2=(x+r*rannor(123))/sqrt(1+r**2);
y=0.001+1*x+1*x2>rannor(123);
if mod(i,5)=0 then x=.;
else if mod(i,6)=0 then x2=.;
output;
end;
run;
proc means data=t1 n nmiss mean std skew kurt;
var _numeric_;
run;