Macros for SAS Application Developers
No Matches File Reference

Generates a stage dataset to revert diffs tracked in an audit table. More...

Go to the source code of this file.

Detailed Description

A big benefit of tracking data changes in an audit table is that those changes can be subsequently reverted if necessary!

This macro prepares a staging dataset containing those differences - eg for:

  • deleted rows - these are re-inserted
  • changed rows - differences are reverted
  • added rows - marked with _____DELETE__THIS__RECORD_____="YES"

These changes are NOT applied to the base table - a staging dataset is simply prepared for an ETL process to action. In Data Controller, this dataset is used directly as an input to the APPROVE process (so that the reversion diffs can be reviewed prior to being applied).

[in]libdsBase library.dataset (will not be modified). The library must be assigned.
[in]loadrefUnique identifier for the version to be reverted. This change, plus ALL SUBSEQUENT CHANGES, will be reverted in the output table.
[in]difftableThe dataset containing the diffs. Definition available in
[in]filtervar=(0) If provided, the contents of this macro variable will be applied as an additional filter against &libds
[out]outds=(work.mp_stripdiffs) Output table containing the diffs. Has the same format as the base datset, plus a _____DELETE__THIS__RECORD_____ variable.
[in]mdebug=set to 1 to enable DEBUG messages and preserve outputs

SAS Macros

Related Macros

Allan Bowe

Definition in file