O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 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.

                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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required