As
you modify a data set, you might want to track the changes that you
make by using an audit trail. An audit trail is an optional SAS file
that logs modifications to a SAS table. Audit trails are used to track
changes that are made to the data set in place. Specifically, audit
trails track changes that are made with the following:
-
-
-
the MODIFY statement in the DATA step
-
the UPDATE, INSERT, or DELETE statement in PROC SQL
For each addition, deletion,
and update to the data, the audit trail automatically stores a copy
of the variables in the observation that was updated, and also stores
information such as who made the modification, what was modified,
and when the modification was made. The audit trail can also store
additional information in user-defined variables.
The following PROC CONTENTS
output lists the variables in an audit trail file for a data set that
has two variables, A and B. You learn more about these variables later
in this chapter.
CAUTION:
Any procedure or action
that replaces the data set (such as the DATA step, CREATE TABLE in
PROC SQL, or SORT without the OUT= option) deletes the audit trail.
Audit trails should not be deleted with system tools such as Windows
Explorer.
A SAS table can have
only one audit trail file. The following statements are true about
the audit trail file:
-
-
It is created by PROC DATASETS.
-
It must be in the same library
as the data file that is associated with it.
-
It has the same name as the data
set it is monitoring, but with a member type of AUDIT.