data grade1; /*数据集grade1创建*/
input number math chinese;
cards;
1001 95 98
1002 87 89
1003 78 67
;
run;
data grade2; /*数据集grade2创建*/
input number english;
cards;
1002 77
1003 89
1001 98
1004 89
;
run;
data grade;
merge grade1 grade2; /*合并数据集grade1和grade2*/
run;
proc print data=grade; /*输出窗口打印出横向连接后的数据集*/
run;
proc sort data=grade2; /*按照number的升序排列对数据grade2进行排序*/
by number;
run;
data grade;
merge grade1 grade2; /*合并数据集grade1和grade2*/
by number;
run;
proc print data=grade; /*输出窗口打印出横向连接后的数据集*/
run;