data s2(keep=code new y m d tturn tag);
set s1;
by tag;
if first.tag then do;
call symput("price",new); p=symget("price");
end;
else do;
code0=code;new0=new;y0=y;m0=m;d0=d;tturn0=tturn;tag0=tag;
code1=lag(code);new1=lag(new);y1=lag(y);
m1=lag(m);d1=lag(d);tturn1=lag(tturn);tag1=lag(tag);
if (new1<=1.0012*p and new1>=0.9988*p)
and new0>1.0012*p or new0<=0.9988*p then do;
code=code0;new=new0;y=y0;m=m0;d=d0;tturn=tturn0;tag=tag0;
output;
end;
end;
run;
再问:若对某数据集进行了分组,在读入记录的过程中,要求读入每组的第一条记录后,不执行后面的某些操作,记录指针下移一条,如何实现?作者: shiyiming 时间: 2004-3-15 22:53
You did nothing with SYMPUT AND SYMGET, after the first.tag record, p is always missing. At least, you should RETAIN P.
Check RETURN statement.作者: shiyiming 时间: 2004-3-17 10:57 标题: Thanks! yes! i see. i have worked it out!