Example 3.1 Merging Data Sets by a Common Variable
Match and merge observations from two data sets based on a variable common to both. To make the new data set more informative, create a new variable whose values indicate the data set origin of each observation, and replace the missing values that result from the merge operation with meaningful values.
|Featured Step||DATA step|
|Featured Step Options and Statements||Match-merge with MERGE and BY statements IN= data set option|
|Related Technique||PROC SQL, FULL JOIN, COALESCE function|
Input Data Sets
Data set TASKS contains task assignments for five employees. Data set HOURS contains the available hours for five employees. Some employees have data in only one of the two data sets ...