Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_loadformat.sas File Reference

Loads a format catalog from a staging dataset. More...

Go to the source code of this file.

Detailed Description

When loading staged data, it is common to receive only the records that have actually changed. However, when loading a format catalog, if records are missing they are presumed to be no longer required.

This macro will augment a staging dataset with other records from the same format, to prevent loss of data - UNLESS the input dataset contains a marker column, specifying that a particular row needs to be deleted (delete_col=).

Positions of formats are made using the FMTROW variable - this must be present and unique (on TYPE / FMTNAME / FMTROW).

This macro can also be used to identify which records would be (or were) considered new, modified or deleted (loadtarget=) by creating the following tables:

  • work.outds_add
  • work.outds_del
  • work.outds_mod

For example usage, see test (under Related Macros)

Parameters
[in]libcatThe format catalog to be loaded
[in]libdsThe staging table to load
[in]loadtarget=(NO) Set to YES to actually load the target catalog
[in]delete_col=(_____DELETE__THIS__RECORD_____) The column used to mark a record for deletion. Values should be "Yes" or "No".
[out]auditlibds=(0) For change tracking, set to the libds of an audit table as defined in mddl_dc_difftable.sas
[in]locklibds=(0) For multi-user (parallel) situations, set to the libds of the DC lock table as defined in the mddl_dc_locktable.sas macro.
[out]outds_add=(0) Set a libds here to see the new records added
[out]outds_del=(0) Set a libds here to see the records deleted
[out]outds_mod=(0) Set a libds here to see the modified records
[in]mdebug=(0) Set to 1 to enable DEBUG messages and preserve outputs

SAS Macros

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_loadformat.sas.