Previous Page | Next Page

Updating SAS Data Sets

Understanding How to Select BY Variables

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:

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.

Previous Page | Next Page | Top of Page