As shown, all observations now include values for the variable Mineral. The value of
Mineral is set to missing for some observations. Observations 2 and 6 in the transaction
data set did not have corresponding observations in Master2, and they have become new
observations. Observation 3 from the master data set was written to the new data set
without change, and the value for Plant2 in observation 4 was not changed to missing.
Three observations in the new data set have updated values for the variable Plant2.
The following program uses the UPDATEMODE statement option in the UPDATE
statement, and prints the results:
data update2_file;
update master2 nonplant updatemode=nomissingcheck;
by Common;
run;
proc print data=update2_file;
title 'Data Set Update2_File - UPDATEMODE Option';
run;
Output 21.17 Results of Updating with the UPDATEMODE Option
The value of Plant2 in observation 5 is set to missing because the
UPDATEMODE=NOMISSINGCHECK option is in effect.
For detailed examples for updating data sets, see Combining and Modifying SAS Data
Sets: Examples.
Example 4: Updating a Master Data Set By Adding Observations
If the transaction data set contains observations that do not match observations in the
master data set, you must alter the program. The following example uses the MODIFY
statement to update the master data set, Inventory, with values from the transaction data
set, Add_Inventory. The following shows the Inventory and the Add_Inventory input
data sets.
504 Chapter 21 • Reading, Combining, and Modifying SAS Data Sets