A new data set test1 is read from test(two variables: id, a). We want to create an index for test1(index name is called aid since aid is indexed in data set aid). Pay attention how
index, rename and keep is used in data step test1.
data test;
input id a;
cards;
1 1
3 3
2 5
;
run;
data aid (index=(aid));
input aid b;
cards;
1 1
2 3
3 4
;
run;
data test1(index=(aid));
set test(keep=id a );
rename id = aid;
run;
proc contents data=test1;
run;
data merge_1;
merge aid test1;
by aid;
run;
proc print data=merge_1;
run;
No comments:
Post a Comment