/* sort the two datasets by a common variable that has */ /* a unique value for each case. */ proc sort data=dataset1; by id; proc sort data=dataset2; by id; /* combine the two datasets. it does not matter if there is */ /* missing data or an unequal number of cases */ data newdata; merge dataset1 dataset2; by id; run;