-2
我在SAS的數據集,其具有列如下所示:計算年末柱總
日期:該字段的格式是「15Dec2014」 金額:例如20000
我需要計算年終總額總計。因此在特定的一年中,總額爲2014年12月31日。我最終希望將每年的最終總計存儲在單獨的數據集中。有任何想法嗎?
我在SAS的數據集,其具有列如下所示:計算年末柱總
日期:該字段的格式是「15Dec2014」 金額:例如20000
我需要計算年終總額總計。因此在特定的一年中,總額爲2014年12月31日。我最終希望將每年的最終總計存儲在單獨的數據集中。有任何想法嗎?
試試這個: -
/*For each date in a year, 'INTNX' will give you the year end date*/
Data answer;
set your_sas_dataset;
year_end=put(intnx('year ', Date , 0, 'e'),date9.);
run;
/*Summing amount on the year end dates will give us the totals for a particular year as of 31st December*/
Proc sql;
Select year_end, sum(Amount) as year_end_totals
from
answer
group by year_end;
quit;
希望這有助於:-)
這不是一個代碼編寫的服務,請發表你已經嘗試了什麼。這是一個PROC MEANS或PROC SQL,應該是直截了當的,嘗試使用Google搜索「SAS彙總統計」 – Reeza