Updating SAS Data Sets |
The master data set and the transaction data set must be sorted by the same variable or variables that you specify in the BY statement. Select a variable that meets these criteria:
The value of the variable is unique for each observation in the master data set. If you use more than one BY variable, no two observations in the master data set should have the same values for all BY variables.
Some examples of variables that you can use in the BY statement include employee or student identification numbers, stock numbers, and the names of objects in an inventory.
If you are updating a data set, you probably do not want duplicate values of BY variables in the master data set. For example, if you update by NAME, each observation in the master data set should have a unique value of NAME. If you update by NAME and AGE, two or more observations can have the same value for either NAME or AGE but should not have the same values for both. SAS warns you if it finds duplicates but proceeds with the update. It applies all transactions only to the first observation in the BY group in the master data set.
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.