The SORT Procedure
By default, PROC PRINT lists observations in the order in which they appear in your data set. To sort your report based on values of a variable, you must use PROC SORT to sort your data before using the PRINT procedure to create reports from the data.
The SORT procedure does the following:
rearranges the observations in a SAS data set
creates a new SAS data set that contains the rearranged observations
replaces the original SAS data set by default
can sort on multiple variables
can sort in ascending or descending order
treats missing values as the smallest possible values
Note: PROC SORT does not generate printed output.
Syntax, PROC SORT step:
PROC SORT DATA=SAS-data-set ...
Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.