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. Fourteen check macros support CDISC SDTM 3.1.1 and 3.1.2 validation. CDISC CRT-DDS 1.0 uses six of these macros.
  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. The SAS Clinical Standards Toolkit check macros support 150 unique CDISC SDTM 3.1.1 validation checks, 243 unique CDISC SDTM 3.1.2 validation checks, 11 unique CDISC CRT-DDS validation checks, and multiple standards. The SAS Clinical Standards Toolkit check macros support validation of CDISC SDTM, CDISC ADaM, CDISC CRT-DDS, and CDISC ODM files.
  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.
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.
This table provides the distribution of validation checks by check macro for both CDISC SDTM 3.1.1 and 3.1.2. For the distribution of validation checks by check macro for CDISC CRT-DDS 1.0, see CDISC CRT-DDS 1.0 Validation Checks.
CDISC SDTM Validation Checks
Check Macro (codesource)
Type of Check (checktype)
Unique Check Identifier (checkid) (add SDTM prefix)
cstcheck_column
Column
0271, 0493, 0494, 0860
ColumnAttribute
0124, 0125, 0126, 0127, 0128, 0129, 0130, 0131
ColumnValue
0204, 0205, 0206, 0207, 0217, 0220, 0222, 0251, 0352, 0354, 0355, 0490, 0506, 0521, 0562
Date
0101, 0102
cstcheck_columncompare
Column
0208, 0212, 0213, 0214, 0215, 0216, 0219, 0223, 0225, 0226, 0231, 0232, 0233, 0351, 0353, 0405, 0406, 0408, 0409, 0410, 0411, 0412, 0413, 0414, 0415, 0416, 0417, 0418, 0419, 0422, 0423, 0462, 0463, 0500, 0501, 0502, 0503, 0507, 0511, 0534, 0541, 0551, 0561, 0843
Date
0209, 0210, 0211, 0407
cstcheck_columnvarlist
ColumnValue
0452
cstcheck_comparedomains
Multitable
0645, 0801, 0804, 0812, 0842, 0844, 0845, 0846
cstcheck_dsmismatch
Metadata
0004, 0005, 0006, 0017
cstcheck_metamismatch
Metadata
0011, 0012, 0013, 0014, 0015, 0019, 0020, 0022, 0023, 0030, 0031, 0032, 0033
cstcheck_notconsistent
Multirecord
0604, 0605, 0607, 0621, 0643, 0644
Multitable
0807
cstcheck_notimplemented
Cntlterm
0449, 0474
Date
0190, 0191, 0192, 0193
Derivation
0441, 0442, 0443
Metadata
0016, 0034, 0035, 0036, 0037, 0038, 0039
Multirecord
0672, 0673
cstcheck_notincodelist
Cntlterm
0218, 0221, 0302, 0401, 0402, 0403, 0450, 0451, 0453, 0454, 0455, 0456, 0457, 0458, 0459, 0460, 0461, 0464, 0465, 0466, 0467, 0470, 0471, 0472, 0473, 0475, 0476, 0477, 0478, 0479, 0480, 0481, 0482, 0483, 0484, 0485, 0486, 0487, 0488, 0489, 0491, 0492, 0495, 0496, 0497, 0498, 0499, 0504, 0505, 0508, 0509, 0510, 0512, 0513, 0514, 0515, 0516, 0517, 0518, 0522, 0523, 0531, 0532, 0533, 0570, 0571, 0572, 0573, 0574, 0575, 0576, 0580
Column
0301, 0303
cstcheck_notsorted
Multirecord
0601
cstcheck_notunique
Multirecord
0602, 0603, 0622, 0623, 0631, 0641, 0642, 0651, 0661, 0662, 0671, 0808, 0809
cstcheck_recmismatch
Multitable
0851, 0861, 0862, 0863, 0864, 0865, 0866, 0871, 0872
cstcheck_recnotfound
Multitable
0802, 0803, 0805, 0806, 0811, 0821, 0822, 0823, 0831, 0836, 0841
cstcheck_violatesstd
Column
0201, 0202, 0203, 0606
cstcheck_zeroobs
Metadata
0001, 0002, 0003
CDISC CRT-DDS 1.0 Validation Checks
Check Macro (codesource)
Check Type (checktype)
Unique Check Identifier (checkid) )
Corresponding CRT-DDS Validation Number*
cstcheck_column
ColumnValue
CRT0106
0013, 0105, 0119, 0140, 0145
CRT0107
0068
CRT0108
0077, 0100, 0101
CRT0109
0131
cstcheck_violatesstd
Column
CRT0101
0000, 0001, 0008, 0009, 0010, 0011, 0012, 0014, 0015, 0016, 0017, 0018, 0019, 0020, 0021, 0022, 0025, 0026, 0027, 0028, 0029, 0030, 0031, 0035, 0036, 0037, 0038, 0040, 0043, 0044, 0046, 0048, 0049, 0051, 0052, 0055, 0056, 0058, 0059, 0060, 0062, 0063, 0066, 0067, 0070, 0071, 0073, 0075, 0078, 0079, 0080, 0081, 0083, 0086, 0089, 0090, 0091, 0092, 0094, 0095, 0096, 0097, 0099, 0104, 0106, 0107, 0108, 0109, 0110, 0112, 0114, 0116, 0117, 0118, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0128, 0130, 0132, 0133, 0135, 0137, 0141, 0142, 0143, 0144, 0146, 0147, 0148, 0149, 0150, 0151, 0152, 0153, 0154
cstcheck_notunique
Multirecord
CRT0100
0000, 0002, 0004, 0009, 0010, 0015, 0022, 0027, 0029, 0043, 0055, 0066, 0071, 0092, 0096, 0110, 0127, 0135, 0142, 0144
cstcheck_recnotfound
Multitable
CRT0110
0008, 0012, 0014, 0017, 0018, 0019, 0020, 0021, 0025, 0026, 0028, 0030, 0031, 0033, 0034, 0035, 0037, 0038, 0048, 0049, 0052, 0059, 0060, 0063, 0069, 0070, 0080, 0081, 0084, 0085, 0086, 0091, 0094, 0095, 0102, 0103, 0104, 0106, 0107, 0108, 0109, 0116, 0117, 0118, 0120, 0121, 0124, 0125, 0126, 0132, 0133, 0137, 0141, 0143, 0146
CRT0111
0023, 0072, 0111
CRT0112
0003, 0024, 0093, 0134, 0138
cstcheck_recmismatch
Multitable
CRT0113
0041, 0042, 0053, 0054, 0064, 0065, 0087, 0088, 0139
cstcheck_notincodelist
Controlterm
CRT0114
0005, 0006, 0007, 0032, 0039, 0045, 0047, 0050, 0057, 0061, 0074, 0076, 0082, 0098, 0113, 0115, 0129
For a full listing of validation checks, see Validation Checks.
More complete documentation is provided for each check macro in Macro Application Programming Interface. This information is derived from the code header. See Special Topic: Validation Customization.