BookmarkSubscribeRSS Feed
iSAS
Quartz | Level 8

I created an audit trail on my table. However, when I altered my table by adding a new column, its audit trail was removed as well. Is there a way to prevent this from happening or audit trail doesn't work when a table is altered?

2 REPLIES 2
ballardw
Super User

From documentation on audit trails

Preservation by Other Operations

The audit trail is not recommended for data files that are copied, moved, sorted in place, replaced, or transferred to another operating environment. Those operations do not preserve the audit trail. In a Copy operation on the same host, you can preserve the data file and audit trail by renaming them using the generation data sets feature. However, logging stops because neither the auditing process nor the generation data sets feature saves the source program that caused the replacement. For more information about generation data sets,

A key word I highlight above is REPLACE. The way SAS manages data once a data set is created then anything that adds a variable replaces the data step.

 

It might help to describe why you are adding variables to a data set that needs auditing.

If the reason was something like "didn't know I needed it" you have a live and learn moment.

If the reason is following the often dubious spread sheet approach of adding a separate column for every year/month/week or every level of a product then the data design is just plain wrong, especially for audit purposes, and you would be better off having a variable to hold the "type" of value.

instead of

 

Store  JanSalesTotal FebSalesTotal MarSalesTotal <etc>

better would be

Store SalesMonth  Total

where SalesMonth would take values like Jan Feb Mar, which are currently data in the title of the variable.

)best would likely be to store that Month as an actual SAS date such as the first or last day of the reporting month)

 

You might also look at the SASHELP.CARS data set for a product type example. Instead of having separate values for Sedan, SUV, Pickup or such and a separate price, engine size, horsepower column fore each type of car you have the type as a variable.

 

 

 

 

iSAS
Quartz | Level 8
Thank you for the detailed explanation ballardw!

Would just like to ask, is there a command to turn-off audit trail in a table?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 752 views
  • 0 likes
  • 2 in conversation