Proc SORT sorts data in order that further analysis can be performed, such as "BY" variable processing. Files may be sorted on multiple columns, in either ascending or descending order. A file may be sorted either explicitly, as part of a sort procedure, or else implicitly in order to perform some other analysis such as Univariate, Same Same, Same, Outlier, etc.
There is no effective limit on the size of a file that may be sorted, other than restraints imposed by limitations in storage space. The system reads the file to be sorted a "chunk" at a time, sorts the records in memory and then writes that chunk back to disk. Once all the individual records within the chunks are sorted, they are then merged. In some instances, the process can be disk intensive. The sort algorithm used is the Quicksort.
Proc SORT

Sorting can also be performed in batch, using a script:
PROC SORT Syntax
proc sort data=DATAFILE;
by SORTLIST;
out = OUTPUTRESULT;
Parameters Used
There are three primary parameters for the Sort command:
DATAFILE - the datafile to be sorted
SORTLIST - the sort parameters for the variables to be sorted
OUTPUTRESULT - name of the file to store the sorted results
Example Script
*;
* sort2.ezs;
* sort a file consisting of tab separated columns;
* limit the sort to the first 5,000 observations; options obs=5000;
libname test 'c:/ezs/tab';
libname drug 'c:/ezs/output';
proc sort data=test.vendors;
out=drug.srtvendors2;
by locationzip vendorphone desc;
run;
The Proc Sort procedure is part of EZ-R Stats for Windows
Analysts interested in Proc SORT may also be interested
in Proc Means and Proc Univariate.

