data a;
input No;
datalines;
1
2
3
;
run;
data b;
input gg;
datalines;
1
;
run;
data all;
if _n_=1 then set b;
set a;
run;
proc print;run;
结果
all |
ObsggNo
111
212
313
去掉if _n_=1 then 的话结果就是只有第一行,第一行我能理解,两个set把列合并了,取小的行数;但是不删去输出结果的机制实在是不明白,看了看一本书上的定义:Two automatic variables are created by every DATA step: _N_ and _ERROR_.
_N_
is initially set to 1. Each time the DATA step loops past the DATA statement, the
variable _N_ increments by 1. The value of _N_ represents the number of times
the DATA step has iterated.
还是不能理解这代码在干什么。求大神指导!谢谢~