Example 4.5 Performing a Table Lookup When the Lookup Data Set Is Indexed


Combine two data sets by using a table lookup technique that directly accesses the lookup data set through an index on a key variable. This lookup technique is appropriate for a large lookup data set.

Example Features

Featured StepDATA step
Featured Step Options and StatementsSET statement, KEY= option Automatic variable_IORC_Macro function %SYSRC
Related TechniquePROC SQL, INNER JOIN, ON clause, subqueries

Input Data Sets

Data set INVOICES contains a list of invoices for five insurance policies. Data set POLICIES contains data for 12 policy holders.


Obs         id      salesdate      amount 1 JL80SHJ0981I 05/01/2009 $543.22 2 LZJ4NWZOPH1W 05/01/2009 $910.09 3 6VIKYDYXMC8I ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.