[問題] SAS-新變項之小數點設定

看板Statistics作者 (the known unknown)時間18年前 (2008/04/16 01:26), 編輯推噓2(201)
留言3則, 3人參與, 最新討論串1/1
想請問一下,以下列語法為例,想將age取到小數點第二位,該如何取呢? (其中,age是由input中a2、a3、a4所共同建立之新變項) -- data try; infile "d:\soci\socialchange\90q1.txt"; input #1 a1 8 a2 16 a3 17-18 a4 19-20 #13; data try; set try; a5=90+a1/12; if a4=97 then a6=0; else if a4 ne 97 then a6=a4/12; a7=a3+a6; age=a5-a7; run; PROC SORT data=try; by a2; proc freq data=try; TABLE age; by a2; RUN; -- 試過兩種方法: 1.age=a5-a7 .2 2.proc means; maxdec=2 但以上兩者卻都沒作用...>"< 希望會的人能指點一下~ 感恩! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.119.128.138 ※ 編輯: wannablue 來自: 140.119.128.138 (04/16 01:37)

04/16 13:38, , 1F
format age comma5.2;
04/16 13:38, 1F

04/16 18:06, , 2F
感謝樓上... 不過試過還是沒用...@@
04/16 18:06, 2F

04/16 21:29, , 3F
age=round(a5-a7,0.01);
04/16 21:29, 3F
文章代碼(AID): #181EL0sG (Statistics)