Example 6.3 Merging Data Sets and Conditionally Overwriting Common Variables

Goal

Merge two data sets so that the values of common variables in the master data set are updated with the values of the common variables in another data set for all matching observations. When an observation in the master data set does not have a match in the second data set, do not overwrite values for the common variables with missing values.

Examples 6.1, 6.2, 6.3, 6.4, and 6.5 illustrate ways to update common variables when combining data sets. The five examples apply the methods to the same master data set. Different transaction data sets are used in Examples 6.1, 6.2, and 6.3. Examples 6.4 and 6.5 use the same transaction data set and produce different resulting ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.