SAS author's tip: Using a MODIFY statement to update a master file from a transaction file

0

Cody's Collection of Popular SAS Programming TasksThis week's SAS tip is from Ron Cody and his new book Cody's Collection of Popular SAS Programming Tasks and How to Tackle Them. If you're a SAS user and haven't explored Ron's work, you're missing out! Visit Ron's author page to view his extensive list of SAS books, user reviews, free chapters, and more.

The following excerpt is from SAS Press author Ron Cody and his book "Cody's Collection of Popular SAS Programming Tasks and How to Tackle Them". Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)

Using a MODIFY statement to update a master file from a transaction file

If you prefer to update your original SAS data set with data from a transaction file, you can use a MODIFY statement. Unlike UPDATE, this technique does not create a new data set but modifies the original data set.

Although you do not have to sort your master file and transaction file when using a MODIFY statement followed by a BY statement, doing so will improve efficiency.

The following short program shows how you can update a master file from data in a transaction file using MODIFY:

After you run this program, the SAS data set Hardware will be identical to the Hardware_June2012 data set created in the previous task.

View additional SAS tips from Ron Cody's books that have been featured on this blog: Computing some useful constants; Using informats to filter invalid valuesA short-cut for requesting multiple tables and Creating a bar chart using PROC SGPLOT.

Share

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Comments are closed.

Back to Top