作者chinmantic (冬去春來秋又過)
看板Statistics
標題[問題] sas 的merge問題
時間Wed Sep 10 19:00:13 2008
想請教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
1F:推 bugle:set 又 merge 你叫 data step 執行那個? 09/10 19:12
2F:→ chinmantic:謝謝樓上指教 我最大的問題是合併ab沒問題 但合併cd卻 09/10 19:21
3F:→ chinmantic:發生如文中敘述的問題 (使用同樣的語法) 09/10 19:21
4F:推 tew:基本上 你的程式依然是有問題的,即使合併a b沒問題 09/11 01:15
5F:推 tew:不表示指令是正確的,錯誤的研究邏輯可以得到正確的結果 09/11 01:15
6F:推 tew:不能表示研究邏輯就是正確的,以結果論來回溯程式正確 很可怕 09/11 01:16