Example 4.4 Performing Multiple Lookups for Each Observation in a Data Set


Perform multiple lookups in other data sets for each observation in a data set. The lookup values are codes, and full information is found for the codes in the other data sets.

Example Features

Featured StepDATA step
Featured Step Options and StatementsHash object in the DATA step
Related TechniquePROC FORMAT CNTLIN= option and DATA step with PUT function and END= data set option

Input Data Sets

Data set SUPPLEMENTS is one of two lookup tables. It contains a list of vitamins and supplements.


Obs    suppid    suppname          fullsuppname 1 V001 Vitamin A Beta Carotene 2 V002 Vitamin B-1 Thiamine 3 V003 Vitamin B-2 Riboflavin 4 V004 Vitamin B-3 Niacinamide 5 V005 ...

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.