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.1 Performing a Simple Table Lookup

Goal

Find a match in a lookup table for the current value of the key column in the primary table. For observations in the primary table with no match in the lookup table, assign a default value to the lookup column.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsLeft join ON clause
Related Technique 1Hash object in the DATA step
Related Technique 2DATA step match-merge, MERGE statement with IN= option

Input Tables

Table SALARIES contains salaries for four employees identified by column EMPNUM. Table BRACKETS contains tax brackets for five employees. Column EMPNUM is common to both tables.

     SALARIES

Obs  empnum     salary 1 1234 $125,000 2 3333 $85,000 3 4876 $54,000 4 5489 $29,000 ...

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