看板 Statistics 關於我們 聯絡資訊
如果是跟統計軟體有關請重發文章,使用程式做為分類。 統計軟體,如SPSS, AMOS, SAS, R, STATA, Eviews,請都使用程式做為分類 請詳述問題內容,以利板友幫忙解答,過短文章依板規處置,請注意。 為避免版面混亂,請勿手動置底問題,擅用E做檔案編輯 小弟是超入門SAS新手 在練習的時候遇到一些問題想請教版上各位大大 如何使用proc format 將資料 02-22222222 輸出成 (02)0000-0000 以及將 $10,000 加上99之後輸出成 ***NT$10,099 呢? 以下是小弟的打法 --- proc format; pitcure telfmt low-high='(00)0000-0000'; pitcure expfmt low-high='***NT00,000'; data aa; infile 'C:\aa' input tel$ expense$; format tel telfmt. expense expfmt.; proc print; run; ---- 除了 NT加上99還沒打出來外 run完以後 log都是出現 "找不到或是無法載入" 請各位大大指導指導 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.198.186.123 ※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1514028624.A.FBD.html ※ 編輯: houan1031 (114.198.186.123), 12/23/2017 19:32:18 ※ 編輯: houan1031 (114.198.186.123), 12/23/2017 19:32:47 ※ 編輯: houan1031 (114.198.186.123), 12/23/2017 19:33:11 ※ 編輯: houan1031 (114.198.186.123), 12/23/2017 19:33:36 ※ 編輯: houan1031 (114.198.186.123), 12/23/2017 21:05:12
west1996: y法中建的telfmt expfmt是數字型格式,但input進來的 12/23 22:42
west1996: 是文字型變數,這樣套不進去 12/23 22:43
不過我原始資料中 電話是02-00000000 月支出是$10000 如果INPUT不打$也沒辦法出現 請問這樣要怎麼調整呢? ※ 編輯: houan1031 (114.198.186.123), 12/23/2017 22:56:13
melodyheyhey: proc format; 12/25 23:07
melodyheyhey: picture telfmt other='090)0000-0000' (prefix='( 12/25 23:07
melodyheyhey: '); 12/25 23:07
melodyheyhey: picture expfmt other='0000000,000' ( fill='*' pr 12/25 23:07
melodyheyhey: efix='NT' ); 12/25 23:07
melodyheyhey: run; 12/25 23:07
melodyheyhey: data a; 12/25 23:07
melodyheyhey: input tel comma11. exp comma9.; 12/25 23:07
melodyheyhey: exp=exp+99; 12/25 23:07
melodyheyhey: format tel telfmt.; 12/25 23:07
melodyheyhey: format exp expfmt.; 12/25 23:07
melodyheyhey: cards; 12/25 23:07
melodyheyhey: 02-22222222 $10,000 12/25 23:07
melodyheyhey: ; 12/25 23:07
melodyheyhey: proc print; 12/25 23:07
melodyheyhey: run; 12/25 23:07
melodyheyhey: 要先講讀進去的資料變成乾淨的數值(comma)才能再 12/25 23:08
melodyheyhey: 做轉換 12/25 23:08