为什么“if _n_=1 then do until (last)”这一段中要用if _n_=1来判断呢?如果不
用的话,sum_x sum_y都是可以正确求出来,但是obs就是missing
请教一下这儿‘if _n_=1’起的什么作用?
data temp;
input x y@;
datalines;
1 2
3 4
5 6
. 9
6 7
7 .
1 8
6 3
;
run;
data q3;
if _n_=1 then do until (last);
set temp nobs=obs end=last;
sum_x+x;
sum_y+y;
end;
set temp;
if x=. then x=sum_x/obs;
if y=. then y=sum_y/obs;
run;