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 by SAS 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. This 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.
stcheckcompareallcolumns
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 utility macro %cstutil_readcontrol, 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 utility macro %cstutil_buildcollist (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 use of each check macro, by standard and version, is summarized in this display.
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 online macro API reference documentation. This information is derived from the code headers. See Special Topic: Validation Customization.