sas 文件合并 左联接

sas文件合并,支持左右连接

连接过程 左连接 merge one two;  by ID;

View Code
 1 data one ;
 2 input ID Name $ ;
 3 datalines;
 4 7 Adam
 5 1 Smith
 6 2 Schneider
 7 4 Gregory
 8 ;
 9 data two;
10 input ID category $ time ;
11 datalines;
12 1    IT 3
13 2    economy 2 
14 4    music 4
15 ;
16 proc sort data=one;
17 by ID;
18 run;
19 proc sort date=two;
20     by ID;
21 run;
22 data combine;
23 merge one two;
24     by ID;
25 run;
26 proc print data=combine;
27 run;

运行结果

ObsIDNamecategorytime
1 1 Smith IT 3
2 2 Schneide economy 2
3 4 Gregory music 4
4 7 Adam   .
posted @ 2013-04-25 15:19  xinyonde  阅读(899)  评论(0编辑  收藏  举报