crackman 发表于 2010-3-6 19:21 
total=d1+d2+d3;
计算的是非缺失变量的和
既然D2 D3都有缺失
就不能那样计算了
SAS has many statistic function you can use with a array or a variable list.
Here is an example.
data;
input d1-d3;
array s(*) d1-d3;
n=n(of s(*));
mean=mean(of s(*));
sum=sum( of s(*));
do i=1 to dim(s);
if s(i)=. then s(i)=mean;
end;
drop i;
cards;
1 2 7
2 3 .
3 . 4
;
run;
proc print;
run;