→ Dural:謝謝:0 01/09 22:58
這樣應該可以
/*new 是新的資料名稱*/
/*test 是你原本的資料名稱*/
data test;
input ID SHARES YEAR;
cards;
1 100 2010
1 250 2010
2 332 2010
3 250 2010
1 135 2011
1 270 2011
2 345 2011
2 700 2011
;
run;
proc sql;
create table new as
select sum(shares) as shares,id,year
from test
group by id,year
;
quit;
proc print data=new;
run;
應該就是你想要的結果了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.168.13.109