生命不息 发表于 2019-3-12 15:35:41

数据集合并



匹配合并(有by)
data identity;
input id sex $ age;
cards;
1001 f 20
1003 m 22
1002 m 20
1001 f 21
;

proc sort data=identity;
by id;
run;
data score;
input id language $ score;
cards;
1001 English 90
1002 Chinese 93
10001 France 83
;
proc sort data=score;
by id;
run;
data result;
merge identity score;
by id;
run;
proc print data=result;
run;

一对一合并(无by)
data me;
input id sex $ math;
cards;
12 m 80
13 m 76
14 m 96
;
proc print data=me;
run;

data mad;
input id sex $ English Chinese;
cards;
12 F 93 76
13 F 89 78
;
data score;
merge me mad;
run;
proc print;
run;
页: [1]
查看完整版本: 数据集合并