ok - I'm going to assume you didn't necessarily mean that the datasets had to be sorted at the same time (which is possible, using rsubmit or other techniques). If you are happy for the datasets to be sorted in sequence, here is a simple macro solution: data one;
x=1;y=2; output;
x=1;y=3; output;
data two;
x=4;y=6; output;
x=0;y=7; output;
data three;
x=6;y=6; output;
x=6;y=7; output;
%macro sortandappend(datasets=,var=x,outds=outds);
%local i;
%do i=1 %to %sysfunc(countw(&datasets));
%let ds=%scan(&datasets,&i);
proc sort data=&ds;
by &var;
run;
%end;
data &outds;
set &datasets;
run;
%mend;
%sortandappend(datasets=one two three,var=x,outds=outds) You provide a list of input datasets to the macro (one, two and three), set the variable to sort by, and the dataset to create.
... View more