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 INFORMATION based on ascending values of the variables State and
ZipCode, and replaces the original data set.
proc sort data=information;
by State ZipCode;
run;
As a general rule, when
you use PROC SORT, specify the variables in the BY statement in the
same order that you plan to specify them in the BY statement in the
DATA step. For a detailed description of the default sorting orders
for numeric and character variables, see the SORT procedure in
Base SAS Procedures Guide.
Note: The BY statement honors the
linguistic collation of sorted data when you use the SORT procedure
with the SORTSEQ=LINGUISTIC option.