Chapter Contents |
Previous |
Next |
SORT |
Category: | SAS Table |
Syntax | |
Details | |
Example |
Syntax |
sysrc=SORT(table-id,col-list-1<. . .col-list-4>); |
0 | successful |
0 | not successful |
Type: Numeric
Type: Numeric
/
). Columns
and options cannot be mixed in the same list.
Type: Character
Details |
SORT uses the sorting program that SAS supports on your operating system. If a column list contains more than one column, the table is sorted by those columns in the order in which they are specified.
You can use the following options for col-list, depending on your operating system:
DATECOPY DIAG EQUALS FORCE LEAVE LIST MESSAGE NODUPKEY NODUPLICATES NOEQUALS OUT REVERSE SORTSEQ=ASCII|EBCDIC|DANISH|FINNISH |NATIONAL|NORWEGIAN|SWEDISH SORTSIZE SORTWKNO TAGSORT TRANTAB
SAS views cannot be sorted in place. To sort views, you must specify an output SAS table.
If a SAS table is already in sorted order, then you must use the FORCE option.
Note: Unless you specify
the FORCE option, the SORT function and PROC SORT do not sort and replace
an indexed SAS table, because sorting destroys indexes for the table.
Example |
Use the SORT function with the options NODUPKEY, NODUPLICATES, and TAGSORT to sort the SAS table MYDATA by column A in ascending order and by column B in descending order:
rc=sort(mydataid,'a descending b', '/ nodupkey noduplicates tagsort');
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.