/* this macro will take all the cases from the datasets named */ /* dataset1 through dataset 5 and put them in a dataset named */ /* newdata. the five datasets must have the same number of */ /* variables and the variables must have the same names, */ /* across all the datasets. */ %macro datasets; /* create the new dataset from the first dataset */ proc copy in=dataset1 out=newdata; run; /* add the remaining datasets to the new dataset */ %do j=2 %to 5; proc append base=newdata data=dataset&j; %end; %mend datasets; %datasets;