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 Step | PROC SQL |
Featured Step Options and Statements | Left join ON clause |
Related Technique 1 | Hash object in the DATA step |
Related Technique 2 | DATA 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 ...
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.