data two; length id $1. var $2.; input id $ var $; cards; 1 21 2 23 3 24 4 25 5 27 6 2g 7 2k run; data three; length id $1. var $3.; input id $ var $; cards; 1 31a 2 35a 3 34a 4 350 8 370 9 3gv 0 3ks run; proc sort data=two; by id; run; proc sort data=three; by id; run; /*matched merges*/ data twothree; merge two three; by id; run; data threetwo; merge three two; by id; run; ods listing close; ods chtml file="C:\outputdirectory\two.xls"; proc print data=two noobs; title "dataset two"; run; ods chtml file="C:\outputdirectory\three.xls"; proc print data=three noobs; title "dataset three"; run; ods chtml file="C:\outputdirectory\mergethreetwo.xls"; proc print data=threetwo noobs; title "dataset threetwo: produced by merge three two; by id;"; run; ods chtml file="C:\outputdirectory\mergetwothree.xls"; proc print data=twothree noobs; title "dataset twothree: produced by merge two three; by id;"; run; ods chtml close; ods listing; /*concatenation*/ %verifyVariablesSet(two,three) data twothree; set two three; run; data threetwo; set three two; run; ods listing close; ods chtml file="C:\outputdirectory\concatthreetwo.xls"; proc print data=threetwo noobs; title "dataset threetwo: produced by set three two;"; run; ods chtml file="C:\outputdirectory\concattwothree.xls"; proc print data=twothree noobs; title "dataset twothree: produced by set two three;"; run; ods chtml close; ods listing; /*interleaving*/ data twothree; set two three; by id; run; data threetwo; set three two; by id; run; ods listing close; ods chtml file="C:\outputdirectory\interleavthreetwo.xls"; proc print data=threetwo noobs; title "dataset threetwo: produced by set three two; by id;"; run; ods chtml file="C:\outputdirectory\interleavtwothree.xls"; proc print data=twothree noobs; title "dataset twothree: produced by set two three; by id;"; run; ods chtml close; ods listing;