By default, the sort
order is based on the alphanumeric value of the sort variable. You
can specify other factors to use for a sort. For example, you can
sort by frequency of a variable occurrence.
The sort function behaves
differently depending on whether you have associated a format with
the variable used for the sort. For example, suppose that an MMDDYY10
format has been applied to a date variable, and you choose to sort
the formatted values rather than the numerical date values. In your
results, sorted in ascending order, a date of 02/05/1982 comes before
07/07/1969 because 02 comes before 07.
The following figure
shows a formatted sort on birthdate values.
Table Sorted by Formatted Dates
For some sort orders,
application of a format produces the same result as no format. In
the previous example, if you perform a frequency sort on the date
variable, then the formatted results are the same as the non-formatted
results. A date that appears three times in the data set also appears
three times in the sorted table regardless of whether the date is
formatted.
The following figure
shows the frequency of birthdate values formatted as MMDDYY10. The
sort order is the same for non-formatted values.
Table Sorted by Frequency of Formatted Dates
However, if you apply
a format such as DOWNAME to the variable, then the results differ.
In this case, you might see three observations grouped together with
a Friday date, three observations for Tuesday, and so on.
The following figure
shows a frequency sort on the same data, but with birthdate values
formatted as DOWNAME. In this case, the format affects the sort order.
Table Sorted by Frequency, Dates Formatted as DOWNAME