[問題] 遇到一個retain的問題

看板Statistics作者 (no matter)時間9年前 (2015/05/28 10:16), 編輯推噓0(005)
留言5則, 2人參與, 最新討論串1/1
想續填入資料,又想避開不同的編碼~ 原始資料格式是這樣: 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://www.ptt.cc/bbs/Statistics/M.1432779408.A.DF7.html

05/28 22:20, , 1F
data code_table; set aa_table;
05/28 22:20, 1F

05/28 22:20, , 2F
by code;
05/28 22:20, 2F

05/28 22:21, , 3F
if first.code then name_389=new_389;
05/28 22:21, 3F

05/28 22:21, , 4F
retain name_389; run;
05/28 22:21, 4F

06/04 16:14, , 5F
可以了~謝謝大大^^
06/04 16:14, 5F
文章代碼(AID): #1LPdgGtt (Statistics)