data a1;
set a;
if dcost=. and lag(dcost) ne . then y=1;
else y+1;
if dcost ne . then y=.;
run;
proc sort data=a1;
by stkcd dadtunit descending y ;
run;
data a2;
set a1;
by stkcd dadtunit descending y;
retain c;
if first.dadtunit and first.y then c=y;
if y=. then c=.;
drop y;
run;
试试看有没有问题?
另,你的数据能不恩能不能不要论坛币啊?


雷达卡
京公网安备 11010802022788号







