Initiating and Reading Audit Trails

Overview

You initiate an audit trail using the DATASETS procedure with the AUDIT and INITIATE statements.
General form, DATASETS procedure to initiate an audit trail:
PROC DATASETS LIB=libref <NOLIST>;
AUDIT SAS-data-set <SAS-password>;
INITIATE;
QUIT;
Here is an explanation of the syntax:
AUDIT
initiates and controls event logging to an audit file.
libref
is the name of the library where the data set to be audited resides.
NOLIST
suppresses the directory listing.
SAS-data-set
is the name of the SAS data set that you want to audit.
SAS-password
is the SAS data set password, if one exists.
INITIATE
begins the audit trail on the data set specified in the AUDIT statement.

Example

The following code initiates an audit trail on the data set Capinfo.
Note: If you choose to run this example, you must copy the data set Capinfo from the Sasuser library to the Work library.
proc datasets nolist;
   audit capinfo;
   initiate;
quit;
Table 18.4 SAS Log
60   audit capinfo;
61   initiate;
WARNING: The audited data file WORK.CAPINFO.DATA is not 
         password protected.
         Apply an ALTER password to prevent accidental 
         deletion or replacement of it and any associated 
         audit files.
62   quit;
NOTE: The data set WORK.CAPINFO.AUDIT has 0 observations 
      and 13 variables.
Note: The audit trail file uses the SAS password that is assigned to the parent data set. Therefore, it is recommended that you alter the password for the parent data set. Use the ALTER= data set option to assign an alter-password to a SAS data set or to access a Read-, Write-, or Alter- protected SAS data set. If another password is used or no password is used, then the audit file is still created, but is not protected.
Tip
For more information about audit trails, see the SAS documentation for the DATASETS procedure.

Reading Audit Trail Files

When the audit trail is initiated, it has no observations until the first modification is made to the audited data set. When the audit trail file contains data, you can read it with any component of SAS that reads a data set. To refer to the audit trail file, use the TYPE= data set option.
General form, TYPE= data set option to specify an audit file:
(TYPE=AUDIT)

Examples

The following PROC CONTENTS code displays the contents of the audit trial file:
proc contents data=mylib.sales (type=audit);
run;
The following PROC PRINT code lists the data in the audit trail file for the data set Capinfo:
proc print data=capinfo (type=audit);
run;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset