作者sheiswe (no matter)
看板Statistics
標題[問題] 遇到一個retain的問題
時間Thu May 28 10:16:45 2015
想續填入資料,又想避開不同的編碼~
原始資料格式是這樣:
data aa_table;
code Ind_15 Ind_71 Ind_389 new_389
211000 21 211 211000 All
211000
211000
211111
211111
211111
211111
211112 211 2111 211100 Other
211112
211112
211112
211112
212000 21 212 212000 Food
212000
data code_table; set aa_table;
retain name_389 new_389;
if name_389^='' then new_389=name_389;
run;
retain後會是這樣:
code Ind_15 Ind_71 Ind_389 new_389 name_389
211000 21 211 211000 All
211000 All
211000 All
211111 All <<<這裡要如何能讓它不要填入,保持空值?
211111 All <<<這裡不要填入
211111 All <<<這裡不要填入
211111 All <<<這裡不要填入
211112 211 2111 211100 Other
211112 Other
211112 Other
211112 Other
211112 Other
212000 21 212 212000 Food
212000 Food
不知道大大們有甚麼方法可以做到?懇求解...謝謝~:'(
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.33.218
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Statistics/M.1432779408.A.DF7.html
1F:→ st410614: data code_table; set aa_table; 05/28 22:20
2F:→ st410614: by code; 05/28 22:20
3F:→ st410614: if first.code then name_389=new_389; 05/28 22:21
4F:→ st410614: retain name_389; run; 05/28 22:21
5F:→ sheiswe: 可以了~謝謝大大^^ 06/04 16:14