data in05;
input x;
cards;
1
2
3
4
;
run;
data Out06;
set In05 nObs=_nObs;
/* lead x by one */
lead_x = .;
_point = _N_ + 1;
if _point <= _nObs then do;
set In05(
keep=x
rename=(x=lead_x)
) point=_point;
end;
run;
请问这里_nobs是观测的数量吗?这是sas的自动变量吗?类似的变量还有哪些?在哪里能够找到列表?还有下面这段程序的_firstpass 这类变量是自己定义的吗?如何起作用?谢谢大家了
data in07;
input obs x y;
cards;
1 1 A
2 2 A
3 3 A
4 4 A
5 5 B
6 6 B
7 7 B
8 8 B
;
run;
proc sort data=In07 out=Sorted;
by y;
run;
data Out07;
set Sorted(in = _firstPass)
Sorted
;
by y;
if _firstPass then do;
if first.y then sum_x = .;
sum_x = sum(sum_x, x, 0);
end; else do; /* second pass */
output;
end;
run;