Re: [程式] SAS proc means 垂直加總

看板Statistics作者 (談無慾)時間9年前 (2015/05/12 14:49), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/4 (看更多)
※ 引述《andersonhaha (好山好水 多健康)》之銘言: : id condition 1997 1998 1999 2010 : 1 A 0 0 0 1 : 1 B 0 1 1 1 : 1 C 0 0 2 2 : 加總 0 1 3 4 : 2 A : 2 B .. .. .. .. .. : [程式範例]: : proc means data=a sum; : class id condition; : var 1997-2010 : output out=b; run; 是這樣嗎?SAS好像跑不太動..(windows full).. : 謝謝指教!! data step1; set demo_data; forsort='1'; format condition $char100.; run; PROC SQL; CREATE TABLE step2 AS SELECT distinct id, "總合" as condition, sum('1997'n) as '1997'n, sum('1998'n) as '1998'n, sum('1999'n) as '1999'n, sum('2000'n) as '2000'n, '2' as forsort FROM WORK.DEMO_DATA group by id; QUIT; data final; set step1 step2; run; PROC SORT DATA= final OUT= final; BY id forsort; RUN; 順便請問一下要怎樣在data set裡面改欄位長度 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.35.215.137 ※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1431413356.A.F85.html
文章代碼(AID): #1LKQ9i-5 (Statistics)
文章代碼(AID): #1LKQ9i-5 (Statistics)