IDXNAME= Data Set Option

Directs SAS to use a specific index to match the conditions of a WHERE expression.

Valid in: DATA step and PROC steps
Category: User Control of SAS Index Usage
Restrictions: Use with input data sets only.
Mutually exclusive with IDXWHERE= data set option

Syntax

IDXNAME=index-name

Syntax Description

index-name

specifies the name (up to 32 characters) of a simple or composite index for the SAS data set. SAS does not attempt to determine whether the specified index is the best one or whether a sequential search might be more resource efficient.

Interaction The specification is not a permanent attribute of the data set and is valid only for the current use of the data set.
Tip To request that IDXNAME= usage be noted in the SAS log, specify the system option MSGLEVEL=I.

Details

To satisfy the conditions of a WHERE expression for an indexed SAS data set, SAS identifies zero or more candidate indexes that could be used to optimize the WHERE expression. From the list of candidate indexes, SAS determines the following:
  • the candidate index that provides the best performance
  • the rejection of all the indexes if a sequential pass of the data is more efficient
Because the index SAS selected cannot always provide the best optimization, you can direct SAS to use one of the candidate indexes by specifying the IDXNAME= data set option. If you specify an index that SAS does not identify as a candidate index, then IDXNAME= does not process the request. That is, IDXNAME= does not enable you to specify an index that would produce incorrect results.

Comparisons

IDXWHERE= enables you to override the SAS decision about whether to use an index, whereas INDEXNAME= enables you to direct SAS to use a specific index.

Example: Specifying an Index

This example uses the IDXNAME= data set option in order to direct SAS to use a specific index to optimize the WHERE expression. SAS then disregards the possibility that a sequential search of the data set might be more resource efficient. SAS does not attempt to determine whether the specified index is the best one. (The EMPNUM index was not created with the NOMISS option.)
data mydata.empnew;
   set mydata.employee (idxname=empnum);
   where empnum < 2000;
run;

See Also

Using an Index for WHERE Processing in SAS Language Reference: Concepts
Data Set Option: