SORTVALIDATE System Option

Specifies whether the SORT procedure verifies if a data set is sorted according to the variables in the BY statement when a user-specified sort order is denoted in the sort indicator.
Valid in: Configuration file, SAS invocation, OPTIONS statement, SAS System Options window
Category: Sort: Procedure options
PROC OPTIONS GROUP= SORT
Note: This option can be restricted by a site administrator. For more information, see Restricted Options.

Syntax

Syntax Description

SORTVALIDATE
specifies that the SORT procedure verifies if the observations in the data set are sorted by the variables specified in the BY statement.
NOSORTVALIDATE
specifies that the SORT procedure is not to verify if the observations in the data set are sorted. This is the default.

Details

You can use the SORTVALIDATE system option to specify whether the SORT procedure validates that a data set is sorted correctly when the data set sort indicator shows a user-specified sort order. The user can specify a sort order by using the SORTEDBY= data set option in a DATA statement or by using the SORTEDBY= option in the DATASETS procedure MODIFY statement. When the sort indicator is set by a user, SAS cannot be absolutely certain that a data set is sorted according to the variables in the BY statement.
If the SORTVALIDATE system option is set and the data set sort indicator was set by a user, the SORT procedure performs a sequence check on each observation to ensure that the data set is sorted according to the variables in the BY statement. If the data set is not sorted correctly, SAS sorts the data set.
At the end of a successful sequence check or at the end of a sort, the SORT procedure sets the Validated sort information to Yes. If a sort is performed, the SORT procedure updates the Sortedby sort information to the variables that are specified in the BY statement.
If an output data set is specified, the Validated sort information in the output data set is set to Yes. If no sort is necessary, the data set is copied to the output data set.

See Also

Sorted Data Sets in SAS Language Reference: Concepts
Data Set Options:
SORTEDBY= Data Set Option in SAS Data Set Options: Reference
Procedures:
DATASETS Procedure in Base SAS Procedures Guide
SORT Procedure in Base SAS Procedures Guide