SAS Data Set Options |
Valid in: | DATA step and PROC steps |
Category: | Data Set Control |
Restriction: | Use with output data sets only. |
Syntax |
INDEX=(index-specification-1 ...<index-specification-n>) |
names and describes a simple or a composite index to be built. Index-specification has this form:
index= (variable(s) </UNIQUE> </NOMISS>) |
is the name of a variable that forms the index or the name you choose for a composite index.
specifies that the values of the key variables must be unique. If you specify UNIQUE for a new data set and multiple observations have the same values for the index variables, the index is not created. A slash (/) must precede the UNIQUE option.
excludes all observations with missing values from the index. Observations with missing values are still read from the data set but not through the index. A slash (/) must precede the NOMISS option.
Examples |
The following INDEX= data set option defines a simple index for the SSN variable:
data new(index=(ssn));
The following INDEX= data set option defines a composite index named CITYST that uses the CITY and STATE variables:
data new(index=(cityst=(city state)));
The following INDEX= data set option defines a simple index for SSN and a composite index for CITY and STATE:
data new(index=(ssn cityst=(city state)));
The following INDEX= data set option defines a simple index for the SSN variable with unique values:
data new(index=(ssn /unique));
The following INDEX= data set option defines a simple index for the SSN variable, excluding all observations with missing values from the index:
data new(index=(ssn /nomiss));
The following INDEX= data set option defines a simple index for the SSN variable and a composite index for CITY and STATE. Each variable must have a UNIQUE and NOMISS option:
data new(index=(ssn /unique/nomiss cityst=(city state)/unique/nomiss));
See Also |
INDEX CREATE statement in "The DATASETS Procedure" in Base SAS Procedures Guide | |
CREATE INDEX statement in "The SQL Procedure" in Base SAS Procedures Guide | |
Understanding SAS Indexes in in the "SAS Data Files" section of SAS Language Reference: Concepts |
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.