Example 4.4 Performing Multiple Lookups for Each Observation in a Data Set
Goal
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 Step | DATA step |
Featured Step Options and Statements | Hash object in the DATA step |
Related Technique | PROC 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.
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.