You can use the SORT
procedure to change the physical order of the observations in the
data set. You can either replace the original data set, or create
a new, sorted data set by using the OUT= option of the SORT procedure.
In this example, PROC SORT rearranges the observations in the data
set Cert.Usa in ascending order based on the values of the variable
Manager. Then, the sorted data is created as a new, sorted data set
Work.Usa.
Note: The default sort order for
the SORT procedure is ascending.
proc sort data=cert.usa out=work.usa;
by manager;
run;
proc print data=work.usa;
run;
Specify the variables
in the PROC SORT BY statement in the same order that you intend to
specify them in subsequent DATA or PROC steps.
The following output
shows the Work.Usa data set sorted by the variable Manager in ascending
order.
Output 8.1 Sorted Work.Usa Data Set