Frequently a SAS programmer needs to both sort and divide a dataset. Typically these tasks are satisfied via a two stage program: (1) divide the dataset, (2) sort the parts. Something like:
data _asia (where=(origin='Asia')) cars_europe (where=(origin='Europe'))
cars_usa (where=(origin='USA')) /view=_asia;
set sashelp.cars;
run;
proc sort data=_asia out=cars_asia;
by msrp;
run;
proc sort data=cars_europe;
by msrp;
run;
proc sort data=cars_usa;
by msrp;
run;
Enabling proc sort to do both of these tasks (with syntax such as below) would often significantly reduce input/output activity, and offer a bit of code simplification:
proc sort data=sashelp.cars
out=cars_asia (where=(origin='Asia'))
cars_europe (where=(origin='Europe'))
cars_usa (where=(origin='USA')) ;
by msrp;
run;
Of course, the multiple output datasets need not be mutually exclusive like the example above.