198 data b;
199 put _all_;
200 if _n_=1 then set a;
201 put _all_;
202 put "-------------";
203 run;
name= score=. _ERROR_=0 _N_=1
name=li score=91 _ERROR_=0 _N_=1
-------------
name=li score=91 _ERROR_=0 _N_=2
name=li score=91 _ERROR_=0 _N_=2
-------------
NOTE: DATA STEP stopped due to looping.
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: The data set WORK.B has 2 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
First loop: _N_=1, SAS 读取第一行, li 91; 并输出到b
Second loop: _N_=2, 此时PDV中name=li, score=91, 因为if 语句不满足,所以不再执行set动作,PDV中的值也就不会更新,之后输出到b;
由于没有要求SAS继续读取数据,此时SAS停止此data step。