Chapter Contents |
Previous |
Next |
SORT |
Language element: | procedure |
OpenVMS specifics: | available sort routines |
Syntax | |
Details | |
NODUPKEY Option | |
SORTWKNO= Option | |
Customizing Collating Sequences | |
See Also |
Syntax |
PROC SORT <option(s)> <collating-sequence-option>; |
Note: This is a simplified version of the
SORT procedure syntax.
For the complete syntax and its explanation, see the SORT procedure in SAS Procedures
Guide.
Details |
By default under OpenVMS,
the SORT procedure uses the ASCII collating sequence. Whenever the SORT procedure
uses the HOST sort utility, it uses the OpenVMS sort
utility. (For information about how the sort utility is chosen, see the discussion
of the SORTPGM= system option in SORTPGM=.)
The HOST sort utility accepts all options that are available to the SAS sort
utility. For a complete list of options, see the SORT procedure in the SAS Procedures Guide.
When you use the SAS sort utility, the NODUPKEY option implies the EQUALS option by default. As a result, the observation that is returned for like BY values is the first observation that was encountered for the key BY variable. That is, the observations are returned in the order in which they were input.
By contrast, the OpenVMS sort utility does not support
the EQUALS option in conjunction with the NODUPKEY option. When NODUPKEY is
used with the OpenVMS sort utility,
the EQUALS option is set to NOEQUALS unconditionally. As a result, when NODUPKEY
is specified with the OpenVMS sort
utility, the observation that is returned for observations with like BY values
is not guaranteed to be the first observation that was encountered for that
BY variable. The observation that the OpenVMS sort
utility returns when NODUPKEY is in effect is unpredictable.
The OpenVMS sort utility can support up to 10 work files. If you set SORTWKNO= to 0 and define the ten sort work files, the SAS System uses the ten files. To use the sort work files, you must define a SORTWORK# logical name for each sort work area. For example:
$DEFINE SORTWORK0 DISK1:[TEMP] $DEFINE SORTWORK1 DISK2:[TEMP] $DEFINE SORTWORK2 DISK3:[TEMP]
The following example uses the SORTWKNO= option to specify that four work files should be used:
libname mylib '[mydata]'; proc sort data=mylib.june sortwkno=4; by revenue; run;
If you want to provide your own collating sequences or change a collating sequence provided for you, use the TRANTAB procedure to create or modify translation tables. For complete details on the TRANTAB procedure, see SAS Procedures Guide. When you create your own translation tables, they are stored in your PROFILE catalog, and they override any translation tables that have the same names in the HOST catalog.
Note: System managers can modify the HOST catalog by
copying newly created tables from the PROFILE catalog to the HOST catalog.
Then all users can access the new or modified translation table.
If you are using the SAS windowing environment and want to see the names of the collating sequences that are stored in the HOST catalog, issue the following command from any window:
CATALOG SASHELP.HOST
If you are not using the SAS windowing environment, then issue the following statements to generate a list of the contents of the HOST catalog:
proc catalog catalog=sashelp.host; contents; run;Entries of type TRANTAB are the collating sequences.
To see the contents of a particular translate table, use the following statements:
proc trantab table=table-name; list; run;The contents of collating sequences are displayed in the SAS log.
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.