Managing Indexes with PROC SQL

Overview

You can also create or delete indexes from an existing data set within a PROC SQL step. The CREATE INDEX statement enables you to create an index on a data set. The DROP INDEX statement enables you to delete an index from a data set.
General form, PROC SQL to create and delete an index:
PROC SQL;
CREATE <UNIQUE > INDEX index-name
ON table-name(column-name-1<...,column-name-n>);
DROP INDEX index-name FROM table-name;
QUIT;
Here is an explanation of the syntax:
index-name
is the same as column-name-1 if the index is based on the values of one column only.
index-name
is not the same as any column-name if the index is based on multiple columns.
table-name
is the name of the data set that index-name is associated with.

Example

The following example creates a simple index named Origin on the Sasuser.Sale2000 data set. The index is based on the values of the Origin column.
proc sql;
   create index origin on sasuser.sale2000(origin);
quit;
The following example deletes the Origin index from the Sasuser.Sale2000 data set and creates a new index named Tofrom that is based on the concatenation of the values from the columns Origin and Dest:
proc sql;
   drop index origin from sasuser.sale2000;
   create index Tofrom
      on sasuser.sale2000(origin, dest);
quit;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.145.158