merge合并2个或2个以上的数据集。
libname saslib "k:\sas";
data saslib.goodsprice;
input id name$ price 6.2;
datalines;
1 鼠标 35.6
2 键盘 28.95
3 鼠标垫 8.2
4 耳麦 29.7
;
data saslib.goodsquantity;
input id quantity;
datalines;
1 150
2 98
4 162
3 45
;
proc sort data=saslib.goodsprice;
by id;
proc sort data=saslib.goodsquantity;
by id;
data saslib.mygoods;
merge saslib.goodspricesaslib.goodsquantity;
by id;
run;
proc print data= saslib.mygoods;
run;
原文地址:http://blog.csdn.net/myhaspl/article/details/44132301