Deanna Warner is a senior technical writer at SAS Institute. She has a Bachelor of Liberal Studies in writing from St.
Updating Data Using the MODIFY Statement and theKEY= Option
Denise J. Moorman and Deanna Warner
Denise J. Moorman is a technical support analyst at SAS Institute. Her area of expertise is base SAS software.Denise has a BS degree in elementary education from Liberty University and a computer programming certificatefrom North Carolina State University. She has been a SAS software user in Cary, NC, since 1993.
Deanna Warner is a senior technical writer at SAS Institute. She has a Bachelor of Liberal Studies in writing from St.Edward's University. Deanna has been with SAS Institute in Austin, Texas since 1982.
Abstract
The purpose of this article is to explain the nuances of the MODIFY statement and the KEY= option, which is
available for both the MODIFY statement and the SET statement. It assumes the reader has used the MODIFY andSET statements and has a general understanding of the KEY= option. The article begins with the MODIFY statementby explaining and comparing the different access methods, one of which uses the KEY= option. In addition, the
article contains examples of how to monitor your updates and how to use MODIFY and KEY= to update like-namedvariables. Then the article goes into more detail regarding the KEY= option for both the MODIFY and SET
statements. Examples are provided to explain how different types of data, like duplicate values for a key variable,can affect results when using KEY=.
Contents
Introduction
Understanding the MODIFY Statement
Sequential Access
Matching Access Using BY Statement
Comparing Matching Access to UPDATE Statement
Direct (Random) Access by Observation Number Using POINT=Direct Access by Index Values Using KEY=
Comparing Matching Access to Direct Access by Index Values Monitoring Update Processing
Performing Automatic Update of Like-Named Variables Using KEY= Using MODIFY in a SAS/SHARE Environment
Comparing MODIFY to SET StatementUnderstanding the KEY= Option
Using KEY= with SET Statement
Handling Duplicate Values for Key Variable
Using MODIFY with Duplicate Key Values in Transaction Data Set Using MODIFY with Duplicate Key Values in Master Data Set
Using MODIFY with Duplicate Key Values in Master Data Set and Transaction Data Set Using SET with Duplicate Key Values in Lookup Data Set Using SET with Duplicate Key Values in Primary Data Set
Using SET with Duplicate Key Values in Primary Data Set and Lookup Data Set
Combining Data Sets with Non-Matching Observations
Adding Variables to the Output Data Set
Using SET with KEY= in SAS/SHARE Environment Version 7 and Version 8 Considerations
1
热门文档