Yet Another Lookup Method: Updatable Indexed Data Sets

Abstract

SAS® has many methods of doing table lookups in data steps: formats, arrays, hash objects, the SASMSG function, indexed data sets, and so forth. Of those, hash objects and indexed data sets allow you to specify multiple lookup keys and return multiple table values. Both can be updated dynamically in the middle of a data step as you obtain new information (such as reading new keys from an input file, or creating new synthetic keys). Hash objects are very flexible and fast, and fairly easy to use, but are limited to the amount of data that can be held in memory. Indexed data sets may be slower, but are not limited to what can fit into memory, and so in some circumstances may be your only option. This presentation discusses how to use an indexed data set for table lookup and update it dynamically using the MODIFY statement and its allies.