Tips and Tricks Catalog

Create and use indexes in SAS

Indexes are special reference tables that the SAS engine can use to speed up data retrieval. Simply put, an index is a pointer to data in a table. In this tips and tricks we will discuss how you can create and use SAS indexes.

Details

Queries created couple of years ago could be more slow today just because the size of the tables queried increased, those tables could require an index?
Before jumping in the detail of the SAS Indexes, an overview of it is way of working will be described:

  • Where are stored the indexes and what do they contains?
  • Once created, are they used by default?
  • What are the different kind of indexes?
We will then see how we can create or delete them using Proc SQL or Data step or Proc Datasets:
  • Create simple index
  • Create composite index
  • Create unique index

Finally, we will see different options allowing you to use them. Via proc sql, it is quite straightforward but with datastep it is not that obvious and this will force us to review the different types of data access: sequential, direct (POINT and MODIFY) or direct via index (KEY and MODIFY). Part of this tips and tricks will be spent on match merge technics in datastep using the _IORC_, _SOK and _SDENOM.

Prerequisites

You have some SAS experience and would like to create and use indexes in order to speed up your queries on big data.




This site uses cookies. .

By continuing to browse the site you are agreeing to our use of cookies. Review our cookies information for more details.