As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Utilize SAS Audit Files to Keep Track of SAS Data Set Updates

From sasCommunity
Jump to: navigation, search
proc datasets library=ctemp;
	audit orsales;

You can direct SAS to keep an audit trail of all of the updates made to a SAS data set. This is particularly handy if you need to determine who updated a SAS data set at any given time for a security review or a data integrity audit. The audit trail file allows you to track patterns of when particular data were added, modified, or deleted. You may even be able to fashion your own update roll-back program from the audit file.

Creating an audit trail file for a SAS data set is easily done via the DATASETS procedure. See the example at right.

Executing the code, at right, results in a SAS audit file named orsales.sas7baud being built in the CTEMP SAS data library. When updates are made to the orsales SAS data set, entries are made to the attendant orsales SAS audit file.

proc contents data=ctemp.orsales(type=audit);
proc print data=ctemp.orsales(type=audit);

You can determine the variables available in your audit file or print the audit file observations using PROC CONTENTS and PROC PRINT, respectively, using the TYPE=AUDIT data set option.

Note that the Member Type in the Attributes section of the CONTENTS output will state "AUDIT", and that you will get a few additional audit-related variables. You can use other SAS procedures, such as PROC REPORT, on the SAS audit file, too.

There is much, much more to discuss on this topic, and the SAS technical writers handle it with their usual thoroughness in Chapter 27, pages 481 - 489 of the SAS 9.2 Language Reference: Concepts document.

If you work in a security-conscious enterprise, or just want to know who, what, how and when an important SAS data set was updated, take a serious look at SAS audit trails.

Submitted by Michael A. Raithel, The man who wrote the book on performance. Contact me at my Discussion Page.