[問題] sas 的merge問題

看板Statistics作者 (冬去春來秋又過)時間17年前 (2008/09/10 19:00), 編輯推噓4(402)
留言6則, 3人參與, 最新討論串1/3 (看更多)
想請教SAS的MERGE問題 我要合併兩個年度的資料 依照ID來合併 以下是合併指令: data test; set aa; proc sort out=a; by id; run; data test2; set bb; proc sort out=b; by id; run; data new; set b a; merge a(in=ina) b(in=inb); by id; if a and inb then output ; run; LOG檔為: NOTE: Variable a is uninitialized. NOTE: There were 61142 observations read from the data set WORK.B. NOTE: There were 60036 observations read from the data set WORK.A. NOTE: There were 60044 observations read from the data set WORK.A. NOTE: There were 61142 observations read from the data set WORK.B. NOTE: The data set WORK.NEW has 0 observations and 87 variables. NOTE: DATA statement used (Total process time): real time 0.43 seconds cpu time 0.40 seconds 想請問為何在NEW中沒有觀察值呢? 另外 我合併很多筆資料 同樣的語法 有的資料可以合併 有的卻出現以上的情況 請問是哪裡出了問題嗎? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.92.101

09/10 19:12, , 1F
set 又 merge 你叫 data step 執行那個?
09/10 19:12, 1F

09/10 19:21, , 2F
謝謝樓上指教 我最大的問題是合併ab沒問題 但合併cd卻
09/10 19:21, 2F

09/10 19:21, , 3F
發生如文中敘述的問題 (使用同樣的語法)
09/10 19:21, 3F

09/11 01:15, , 4F
基本上 你的程式依然是有問題的,即使合併a b沒問題
09/11 01:15, 4F

09/11 01:15, , 5F
不表示指令是正確的,錯誤的研究邏輯可以得到正確的結果
09/11 01:15, 5F

09/11 01:16, , 6F
不能表示研究邏輯就是正確的,以結果論來回溯程式正確 很可怕
09/11 01:16, 6F
文章代碼(AID): #18nwZ0ne (Statistics)
文章代碼(AID): #18nwZ0ne (Statistics)