Chapter Contents

Previous

Next
The SORT Procedure

BY Statement


Specifies the sorting variables.

Featured in: Sorting by the Values of Multiple Variables , Reversing the Order of the Sorted Values , and Displaying the First Observation of Each BY Group


BY <DESCENDING> variable-1 <...<DESCENDING> variable-n>;


Required Arguments

variable
specifies the variable by which PROC SORT sorts the observations. PROC SORT first arranges the data set by the values in ascending order, by default, of the first BY variable. PROC SORT then arranges any observations that have the same value of the first BY variable by the values in ascending order of the second BY variable. This sorting continues for every specified BY variable.


Option

DESCENDING
reverses the sort order for the variable that immediately follows in the statement so that observations are sorted from the largest value to the smallest value.
Featured in: Reversing the Order of the Sorted Values


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.