BYSORTED System Option

Specifies whether observations in one or more data sets are sorted in alphabetic or numeric order or are grouped in another logical order.
Valid in: Configuration file, SAS invocation, OPTIONS statement, SAS System Options window
Category: Input control: Data processing
PROC OPTIONS GROUP= INPUTCONTROL
Note: This option can be restricted by a site administrator. For more information, see Restricted Options.

Syntax

Syntax Description

BYSORTED
specifies that observations in a data set or data sets are sorted in alphabetic or numeric order.
Requirement:When you use the BYSORTED option, observations must be ordered or indexed according to the values of BY variables.
Interaction:If both the BYSORTED system option and the NOTSORTED statement option on a BY statement are specified, then the NOTSORTED option in the BY statement takes precedence over the BYSORTED system option.
Tip:If BYSORTED is specified, then SAS assumes that the data set is ordered by the BY variable. BYSORTED should be used if the data set is ordered by the BY variable for better performance.
NOBYSORTED
specifies that observations with the same BY value are grouped together but are not necessarily sorted in alphabetic or numeric order.
Note:If a procedure ignores the NOTSORTED option in a BY statement, then it ignores the NOBYSORTED system option also.
Tips:When the NOBYSORTED option is specified, you do not have to specify NOTSORTED on every BY statement to access the data sets.

NOBYSORTED is useful if you have data that falls into other logical groupings such as chronological order or linguistic order. NOBYSORTED allows BY processing to continue without failure when a data set is not actually sorted in alphabetic or numeric order.

Details

The requirement for ordering or indexing observations according to the values of BY variables is suspended for BY-group processing when you use the NOBYSORTED option. By default, BY-group processing requires that your data be sorted in alphabetic or numeric order. If your data is grouped in any other way but alphabetic or numeric, then you must use the NOBYSORTED option to allow BY-processing to continue without failure. For more information about BY-group processing, see BY-Group Processing in the DATA Step in SAS Language Reference: Concepts

See Also

Statements:
NOTSORTED option, NOTSORTED in SAS Statements: Reference