Chapter Contents

Previous

Next
INDEX=

INDEX=



Defines indexes when a SAS data set is created

Valid in: DATA step and PROC step
Category: Data Set Control
Restriction: Use with output data sets only.


Syntax
Syntax Description
Examples
Example 1: Defining a Simple Index
Example 2: Defining a Composite Index
Example 3: Defining a Simple and a Composite Index
See Also

Syntax

INDEX=(index-specification-1 ...<index-specification-n>)

Syntax Description

index-specification
names and describes a simple or a composite index to be built. Index-specification has this form:

index <= (variable(s)) > </UNIQUE> </NOMISS>
index is the name of a variable that forms the index or the name you choose for a composite index.
variable(s) is a list of variables to use in making a composite index.
UNIQUE 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.
NOMISS 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


Example 1: Defining a Simple Index

The following INDEX= data set option defines a simple index for the SSN variable:

data new(index=(ssn));  

Example 2: Defining a Composite Index

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)));  

Example 3: Defining a Simple and a Composite Index

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))); 

See Also

INDEX CREATE statement in "The DATASETS Procedure" in the SAS Procedures Guide
CREATE INDEX statement in "The SQL Procedure" in the SAS Procedures Guide
"SAS Indexes" in the "SAS Data Files" section of SAS Language Reference: Concepts


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.