Previous: RECODE, Up: Data Manipulation [Contents][Index]
SORT CASES BY var_list[({D|A}] [ var_list[({D|A}] ] ...
SORT CASES
sorts the active dataset by the values of one or more
variables.
Specify BY
and a list of variables to sort by. By default, variables
are sorted in ascending order. To override sort order, specify (D)
or
(DOWN)
after a list of variables to get descending order, or (A)
or (UP)
for ascending order. These apply to all the listed variables
up until the preceding (A)
, (D)
, (UP)
or (DOWN)
.
The sort algorithms used by SORT CASES
are stable. That is,
records that have equal values of the sort variables will have the
same relative order before and after sorting. As a special case,
re-sorting an already sorted file will not affect the ordering of
cases.
SORT CASES
is a procedure. It causes the data to be read.
SORT CASES
attempts to sort the entire active dataset in main memory.
If workspace is exhausted, it falls back to a merge sort algorithm that
involves creates numerous temporary files.
SORT CASES
may not be specified following TEMPORARY
.