Special Topic: Validation Check Macros

These SAS Clinical Standards Toolkit design requirements shape the implementation of the SAS Clinical Standards Toolkit validation code:
  1. Code modules should be generic and reusable across standards. Twenty-one check macros have been defined in the SAS autocall library to support compliance assessments across supported standards.
  2. Code must run with SAS 9.3.
  3. Code should be written as SAS macros.
  4. SAS macros should have simple parameter signatures. All macros accept a single parameter, _cstControl, which is a single-observation data set that contains check-specific metadata.
  5. SAS macros should be implemented as non-compiled open code.
  6. SAS macros should be callable using the SAS autocall facility. The SAS Clinical Standards Toolkit framework supports a single SAS macros library. Each SAS Clinical Standards Toolkit standard supports an additional macros library, and the macro library is available using the SAS autocall path.
  7. Code modules should be generic and reusable with multiple validation checks. For example, the check macros %CSTCHECK_COLUMN, %CSTCHECK_NOTINCODELIST, and %CSTCHECK_NOTUNIQUE are used by every standard provided with the SAS Clinical Standards Toolkit that supports validation.
  8. To support code generalization, use metadata-driven techniques to provide check-specific information to the check macros, even including which check macro to call.
  9. Code should write processing results to a single validation Results data set. This Results data set should be available for post-process review and reporting.
These design requirements should be used when developing custom validation check macros. The following table identifies and describes the purpose of each of the check macros provided with the SAS Clinical Standards Toolkit:
SAS Clinical Standards Toolkit Validation Check Macros
Check Macro
Code Logic Style
Description of Purpose
%CSTCHECK_COLUMN
Statement
Identifies any invalid column values or attributes.
%CSTCHECK_COLUMNCOMPARE
Step
Supports comparison of column values.
%CSTCHECK_COLUMNEXISTS
By default, this check does not require the use of codeLogic. If the check metadata includes a non-null value of codeLogic, then DATA step code logic is required.
Determines whether one or more of the columns defined in columnScope exist in each of the tables defined in tableScope.
%CSTCHECK_COLUMNVARLIST
Step
Supports comparison of multiple columns within the same data set or across multiple data sets.
%CSTCHECK_COMPAREDOMAINS
Step
Compares values for one or more columns in one domain with values for those same columns in another domain.
%CSTCHECK_CROSSSTDCOMPAREDOMAINS
Step
Generally, compares values for 1+ columns in one table against either those same columns in another domain in another standard, or compares values against metadata from the comparison standard.
%CSTCHECK_CROSSSTDMETAMISMATCH
Step
Identifies inconsistencies between metadata across registered standards.
%CSTCHECK_DSMISMATCH
Step
Identifies any data set mismatches between study and template metadata and the source data library.
%CSTCHECK_METAMISMATCH
Step
Identifies inconsistencies between study and reference column metadata.
%CSTCHECK_NOTCONSISTENT
Step
Identifies any inconsistent column values across records.
%CSTCHECK_NOTIMPLEMENTED
(not used)
Placeholder to report that a check is not yet implemented.
%CSTCHECK_NOTINCODELIST
If lookuptype=DATASET, DATA step code logic required
Else, DATA step code logic is optional
Identifies any column values inconsistent with controlled terminologies.
Requires reference to the SAS format search path built based on type=FMTSEARCH records in the SASReferences control file.
Example is a **STAT value is found other than 'NOT DONE.'
%CSTCHECK_NOTSORTED
(not used)
Identifies any domain that is not sorted by the keys defined in the metadata.
%CSTCHECK_NOTUNIQUE
Not used for functions 1 through 3; DATA step for function 4
A multi-function macro that assesses the uniqueness of data sets, columns, or value-pairs from two columns.
Function 1: Is data set unique by a set of columns?
Function 2: For any subject, are column values unique?
Function 3: Does a combination of two columns have unique values?
Function 4: Are the values in one column (Column2) consistent in each value of another column (Column1)?
%CSTCHECK_RECMISMATCH
Step
Identifies any record mismatches across domains (domain as referenced in another domain).
%CSTCHECK_RECNOTFOUND
Step
Compares the consistency of one or more columns across two tables or enables the comparison of the consistency of one <table>.<column> with another <table>.<column>.
%CSTCHECK_VIOLATESSTD
Statement
Identifies any invalid column values defined in a reference standard.
%CSTCHECK_ZEROOBS
(not used)
Identifies any data set with zero observations.
%CSTCHECKCOMPAREALLCOLUMNS
Step
Compares all columns in one domain with the same columns in other domains.
%CSTCHECKENTITYNOTFOUND
Step
Reports that an entity, typically a file, folder, or column, cannot be found.
%CSTCHECKFOREIGNKEYNOTFOUND
Step
Compares the consistency of one or more columns across two tables, where a column in the first table is a foreign key that points to a primary key in the second table.
Each validation check macro follows a standard basic workflow. Several of the validation check macros perform more complex operations and multiple functions. The basic workflow includes these events:
  1. Call the %CSTUTIL_READCONTROL utility macro, which translates the validation check metadata passed as the input parameter into local macro variables for check macro processing.
  2. Evaluate required check macro-specific metadata values.
  3. Call the %CSTUTIL_BUILDCOLLIST utility macro (or, if processing only domains, %CSTUTIL_BUILDDOMLIST), which evaluates the requested scope of the specific validation check (that is, which tables and columns are to be included when running the check).
  4. Loop through the target tables and columns identified in step 3.
  5. Perform the logic required to properly assess the validation check. This might be the check macro code itself, or the code in the validation check metadata codeLogic field.
  6. Write any informational or error messages to the Results data set. Metrics are written to the Metrics data set.
  7. Clean up any Work files local to the check macro processing.
The following display shows the use of each check macro, by standard and version:
Use of Validation Check Macros by Standard
Use of Validation Check Macros by Standard
More complete documentation is provided for each check macro in the SAS Clinical Standards Toolkit: Macro API Documentation. This information is derived from the code headers. See Special Topic: Validation Customization.