As we have discovered earlier, creating an index is an efficient way of dealing with large datasets. Proc SQL also offers us the option to create and manage indexes.
An index is an auxiliary file that is defined on one or more variables, which are called key columns. The index may be primary or composite, that is, formed of one or multiple variables. The index stores the unique column values and directions that allow access to rows in an indexed manner. Proc SQL benefits from indexes by reading the required record directly rather than following the sequential method. Hopefully, this recap on indexes will bring back memories of the examples we used as part of the DATA step.
Let's create a simple and composite index. The datasets in this chapter are smaller and don't contain hundreds of unique values. There will be no significant benefit of...