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