Chapter Contents

Previous

Next
The DATASETS Procedure

AUDIT Statement


Initiates and controls event logging to an audit file.

AUDIT SAS-file-name <SAS-password>;
INITIATE;
<LOG< BEFORE_IMAGE=YES|NO>
<DATA_IMAGE=YES|NO> <ERROR_IMAGE=YES|NO>;>
<USER_VAR=variable-1 <... variable-n>;>
<SUSPEND|RESUME|TERMINATE;>


Required Arguments and Statements

SAS-file-name
specifies the SAS data file in the procedure input library that you want to audit.

INITIATE
creates an audit file that has the same name as the SAS data file and a data set type of AUDIT. In the initial release of the Audit Trail, the audit file documents additions, deletions, and updates to the SAS data file.


Options

SAS-password
specifies the password for the SAS data file, if one exists.

LOG
specifies the audit settings. The audit settings are

BEFORE_IMAGE=YES|NO
controls the storage of before-update record images.

DATA_IMAGE=YES|NO
controls the storage of after-update record images.

ERROR_IMAGE=YES|NO
controls the storage of unsuccessful after-update record images.

USER_VAR=variable-1 < ... variable-n>
defines optional variables to be logged in the audit file with each update to an observation. The syntax for defining variable formats is
USER_VAR=variable-name-1 <$> <length> <LABEL='variable-label' >
<... variable-name-n <$> <length> <LABEL='variable-label' > >
where

variable-name
is a name for the variable.

$
indicates that the variable is a character variable.

length
specifies the length of the variable. If a length is not specified, the default is 8.

LABEL='variable-label'
specifies a label for the variable.

SUSPEND
suspends event logging to the audit file, but does not delete the audit file.

RESUME
resumes event logging to the audit file, if it was suspended.

TERMINATE
terminates event logging and deletes the audit file.


Creating an Audit File
The following example code shows you how to create the audit file MYLIB.MYFILE.AUDIT to log updates to the data file MYLIB.MYFILE.DATA, storing all available record images:

proc datasets library=MyLib;
   audit MyFile alter=MyPassword;
   initiate;
run;
The following example code creates the same audit file but stores only error record images:
proc datasets library=MyLib;
   audit MyFile alter=MyPassword;
   initiate;
   log data_image=NO before_image=NO;
run; 


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.