ник: Силыч
data work.stc_stc02_01;
*NOTE: There were 4515622 observations read from the data set WORK.STC_STC02_00.
NOTE: The data set WORK.STC_STC02_01 has 4515622 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 11.32 seconds
cpu time 9.81 seconds;
length d1 $ 8. d2 $4. d3 $ 3.;
drop c_key c_max cdate mcode curid datefrom stc d1 d2 d3 d4;
set work.stc_stc02_00;
by cdate mcode curid datefrom;
retain c_key c_max d1 d2 d3 d4;
if _n_=1 then do;
c_key=cdate||mcode||curid;
c_max=datefrom;
end;
if c_key ne cdate||mcode||curid then do;
*--== йа выводилко ==--;
xcdate=d1;
xmcode=d2;
xcurid=d3;
xstc=d4;
xmax=c_max;
c_key=cdate||mcode||curid;
c_max=datefrom;
end;
if c_max le datefrom then do;
*--== йа запоминалко ==--;
c_max=datefrom;
d1=cdate;
d2=mcode;
d3=curid;
d4=stc;
end;
run;
|
з.ы. обратите внимание на статистику
обработка 4 515 622 записей за 11.32 секунды
SAS рулит