WUTeng 发表于 2013-2-28 20:39 
不是啊...我現在有很多家公司..我想把每家公司的最後一天交易的數據顯示出來
Stkcd Rptdt ...
[code]data test;
input stkcd rptdt @@ ;
new_stkcd=put(stkcd,z6.);
informat rptdt yymmdd10.;
format rptdt yymmdd10.;
cards;
000002 2008-01-04
000002 2008-01-04
000002 2008-01-08
000006 2008-02-19
000006 2008-03-06
000245 2008-01-04
000245 2008-01-08
000245 2008-03-20
000245 2008-03-21
;
run;
proc sort data=test;
by new_stkcd rptdt ;
run;
data lastday_stkcd(drop=stkcd);
set test;
by new_stkcd;
if last.new_stkcd ;
run;