jingju11 发表于 2013-1-21 13:31 
在POBEL的程序里,第二步是根据生成的记录序列数来从大的数据集里选择并输出数据。这是个非常简单的sas问 ...
There might be another way to do the subsetting: the FORMAT+PUT() way (see codes below).
Maybe sometimes this method is a bit faster.
/*Previous code is omitted*/
*** Get the needed observations;
fmtname="OBSFMT"; label="OK";
if last.acct_ref_no then do i =1 by 1 while (scan(_obs_need,i,',') ^=' ');
start=input(scan(_obs_need,i,','), best.);
output null_2;
end;
run;
proc format cntlin=null_2;
run;
data null_3;
set null_1;
flag=put(_obs,obsfmt.);
if flag="OK";
drop flag;
run;