You
can create a simple index, which applies to one column only. The name
of a simple index must be the same as the name of the column that
it indexes. Specify the column name in parentheses after the table
name. The following CREATE INDEX statement creates an index for the
Area column in NEWCOUNTRIES:
proc sql;
create index area
on sql.newcountries(area);
You can also create a composite index,
which applies to two or more columns. The following CREATE INDEX statement
creates the index Places for the Name and Continent columns in NEWCOUNTRIES:
proc sql;
create index places
on sql.newcountries(name, continent);
To ensure that each value of the indexed
column (or each combination of values of the columns in a composite
index) is unique, use the UNIQUE keyword:
proc sql;
create unique index places
on sql.newcountries(name, continent);
Using the
UNIQUE keyword causes SAS to reject any change to a table that would
cause more than one row to have the same index value.