MERGE语句——数据集横向合并

一.运用By语句

proc sort data=data-set1 out=data-set2;

by var1;

run;

proc sort data=data-set3 out=data-set4;

by var1;

run;

data data-set5;

merge data-set2 data-set3;

by var1;

run;

(二)SQL(join,left join,right join,full join) [join相当于交集;merge相当于full join,并集]

proc sql;

select * from dataset1 left join dataset2

on dataset1.id=dataset2.id;

quit;

posted @ 2018-02-15 00:56  Jane_lau  阅读(550)  评论(0编辑  收藏  举报