Module Framework

This is the Framework runtime macro library.

The purpose and scope of the SAS Clinical Standards Toolkit can best be described by considering the product name.

Clinical
The SAS Clinical Standards Toolkit focuses primarily on supporting clinical research activities.
These activities involve the discovery and development of new pharmaceutical and biotechnology products and medical devices.
These activities occur from project initiation through product submission and throughout the full product lifecycle.
They do not include non-research patient records or health-care, pharmacy, hospital, and insurance electronic records.

Standards
The SAS Clinical Standards Toolkit initially focuses on standards defined by the Clinical Data Interchange Standards Consortium (CDISC).
CDISC is a global, open, multidisciplinary, nonprofit organization that has established standards to support the acquisition, exchange, submission, and archival of clinical research data and metadata.
The CDISC mission is to develop and support global, platform-independent data standards that enable information-system interoperability, which, in turn, improves medical research and related areas of health care.
The SAS Clinical Standards Toolkit is not limited to supporting CDISC standards. In time, the SAS Clinical Standards Toolkit will support other evolving industry-standard data models.
The SAS Clinical Standards Toolkit framework is designed to support the specification and use of any user-defined standard.

Toolkit
The term "toolkit" connotes a collection of tools, products, and solutions.
The SAS Clinical Standards Toolkit provides a set of standards and functionality that will evolve and grow with future product updates and releases.
Customer requirements and expectations of the SAS Clinical Standards Toolkit will play a key role in the deciding what functionality to provide in future releases.

Since: 1.2

Macro Summary
external

%cst_createdsfromtemplate(_cstStandard=, _cstStandardVersion=, _cstType=, _cstSubType=, _cstOutputDS=, _cstOutputDSLabel=, _cstResultsOverrideDS=);
Creates a zero-observation data set that is based on a template.
external

%cst_createStudyFromStandard(_cstModel=, _cstVersion=, _cstStudyRootPath=);
Creates a study from the selected model and version.
external

%cst_createTablesForDataStandard(_cstStandard=, _cstStandardVersion=, _cstOutputLibrary=, _cstWhereClause=, _cstResultsOverrideDS=, _cstNumObs=0);
Creates tables from registered reference metadata.
external

%cst_deleteProperties(_cstPropertiesLocation=, _cstLocationType=, _cstResultsOverrideDS=);
Reads a properties file or data set and clears global macros, accordingly.
external

%cst_getRegisteredStandards(_cstOutputDS=, _cstResultsDS=);
Generates a data set that contains the installed models and versions.
external

%cst_getStandardSASReferences(_cstStandard=, _cstStandardVersion=, _cstOutputDS=, _cstResultsOverrideDS=);
Retrieves the global SASReference records for a standard.
external

%cst_getstandardsubtypes(_cstStandard=CDISC-TERMINOLOGY, _cstOutputDS=, _cstResultsDS=);
Creates a data set that contains the installed Clinical Terminology subtypes.
external

%cst_getStatic(_cstName=, _cstVar=);
Returns constant values that are used by other macros.
external

%cst_insertStandardSASRefs(_cstSASReferences=, _cstOutputDS=, _cstAddRequiredCSTRefs=0, _cstResultsOverrideDS=);
Inserts missing standards information into a SASReferences file.
external

%cst_registerStandard(_cstRootPath=, _cstControlSubPath=, _cstStdDSName=, _cstStdSASRefsDSName=, _cstStdLookupDSName=);
Registers a new standard within the global standards library.
external

%cst_setProperties(_cstPropertiesLocation=, _cstLocationType=, _cstResultsOverrideDS=);
Reads a properties file or data set and sets global macros, accordingly.
external

%cst_setStandardProperties(_cstStandard=, _cstStandardVersion=, _cstSubType=, _cstResultsOverrideDS=);
Sets specific standard global macro variables from properties files.
external

%cst_setStandardVersionDefault(_cstStandard=, _cstStandardVersion=, _cstResultsOverrideDS=);
Sets the default version for a registered standard.
external

%cst_unregisterStandard(_cstStandard=, _cstStandardVersion=, _cstResultsOverrideDS=);
Unregisters an existing standard from the global standards library.
external

%cst_unsetProperties(_cstPropertiesLocation=, _cstLocationType=, _cstResultsOverrideDS=);
Reads a properties file or data set and clears global macros, accordingly.
external

%cstcheck_column(_cstControl=);
Identifies invalid column values or attributes.
external

%cstcheck_columncompare(_cstControl=);
Compares column values.
external

%cstcheck_columnexists(_cstControl=);
Determines whether columnScope columns exist in the tableScope tables.
external

%cstcheck_columnvarlist(_cstControl=);
Compares columns within the same data set or across multiple data sets.
external

%cstcheck_comparedomains(_cstControl=);
Compares column values in one domain with the values in another domain.
external

%cstcheck_crossstdcomparedomains(_cstControl=);
Compares column values in one table with the columns in another domain.
external

%cstcheck_crossstdmetamismatch(_cstControl=);
Identifies inconsistencies between metadata across registered standards.
external

%cstcheck_dsmismatch(_cstControl=);
Identifies data set mismatches in study and template metadata and source data.
external

%cstcheck_metamismatch(_cstControl=);
Identifies inconsistencies between study and reference column metadata.
external

%cstcheck_notconsistent(_cstControl=);
Identifies inconsistent column values across records.
external

%cstcheck_notimplemented(_cstControl=);
Placeholder to report that a check is not yet implemented.
external

%cstcheck_notincodelist(_cstControl=);
Identifies column values inconsistent with controlled terminologies.
external

%cstcheck_notsorted(_cstControl=);
Identifies a domain that is not sorted by the keys defined in the metadata.
external

%cstcheck_notunique(_cstControl=);
Assesses the uniqueness of records within data sets.
external

%cstcheck_recmismatch(_cstControl=);
Identifies any record mismatches across domains.
external

%cstcheck_recnotfound(_cstControl=);
Compares the consistency of one or more columns across two tables.
external

%cstcheck_violatesstd(_cstControl=);
Identifies invalid column values that are defined in a reference standard.
external

%cstcheck_zeroobs(_cstControl=);
Identifies a data set that contains zero observations.
external

%cstcheckcompareallcolumns(_cstControl=);
Compares all columns in one domain with the same columns in other domains.
external

%cstcheckentitynotfound(_cstControl=);
Reports that a SAS Clinical Standards Toolkit entity cannot be found.
external

%cstcheckforeignkeynotfound(_cstControl=);
Compares the consistency of one or more columns across two tables.
internal

%cstcheckutil_formatlookup(_cstDSN=&_cstDSName, _cstDomOnly=, _cstCol1=&_cstColumn, _cstCol2=, _cstCol2Value=);
Performs a lookup in a format value column.
internal

%cstcheckutilcheckfile(_cstSourceDS=&_cstDSName, _cstSourceC1=&_cstColumn1, _cstSourceC2=&_cstColumn2, _cstSourceDir=, _cstSourceFileRef=, _cstWhereStatement=);
Determines whether a file exists as defined by columns in a source data set.
internal

%cstcheckutilcheckfolder(_cstSourceDS=&_cstDSName, _cstSourceC1=&_cstColumn1, _cstSourceC2=&_cstColumn2, _cstWhereStatement=);
Determines whether a folder exists as defined by columns in a source data set.
internal

%cstcheckutilcheckstructure(_cstSourceDS=&_cstTableScope, _cstStndrd=&_cstStandard, _cstStndrdVersion=&_cstStandardVersion, _cstFileType=DATASET, _cstColumn=, _cstRefColumn=, _cstCmpRc=16);
Compares the structure of data sets against a template.
internal

%cstcheckutilfindsasrefsfile(_cstSASRefsFile=&_cstDSName, _cstStdsDS=glmeta.standards, _cstFTypes=FILE FOLDER CATALOG, _cstOverrideUnresolvedMacro=N);
Determines whether files in the referenced SASReferences data set exist.
internal

%cstcheckutillookupvalues(_cstStdsDS=glmeta.standards);
Determines whether metadata column values are in the StandardLookup data set.
external

%cstgetmetadataforstandard(_cstSASReferences=, _cstResultsOverrideDS=);
Retrieves standard metadata for a standard and version.
internal

%cstupdatestandardsasrefs(_cstSASReferences=, _cstOutputDS=);
Expands all relative paths to full paths in a SASReferences file.
internal

%cstutil_allocatesasreferences(_cstSASRefsType=SASREFERENCES);
Allocates the librefs and filerefs in the SASReferences data set.
external

%cstutil_allocGlobalMetadataLib(_cstLibname=);
Allocates the global standards metadata library in Read-only mode.
internal

%cstutil_appendresultds(_cstErrorDS=, _cstVersion=&_cstStandardVersion, _cstSource=&_cstCheckSource, _cstStdRef=, _cstOrderBy=);
Appends a check-level Results data set to the process Results data set.
internal

%cstutil_buildcollist(_cstFormatType=DATASET, _cstColWhere=, _cstDomWhere=, _cstStd=&_cstStandard, _cstStdVer=&_cstStandardVersion, _cstColDSName=&_cstColumnMetadata, _cstDomDSName=&_cstTableMetadata, _cstColSubOverride=N, _cstDomSubOverride=N);
Builds columns based on the value from validation_control.columnscope.
internal

%cstutil_builddomlist(_cstFormatType=DATASET, _cstDomWhere=, _cstStd=&_cstStandard, _cstStdVer=&_cstStandardVersion, _cstDomDSName=&_cstTableMetadata, _cstSubOverride=N);
Builds a tables based on the value from validation_control.tablescope.
external

%cstutil_buildformatsfromxml(_cstFmtLib=, _cstReplaceFmtCat=Y, _cstFmtCatPrefix=, _cstFmtCatLang=, _cstFmtCatLangOption=English);
Creates format catalogs from codelist information in XML-based standards.
internal

%cstutil_checkds(_cstdsname=, _csttype=, _cstsubtype=, _cststandard=*, _cststandardversion=*);
Validates a data set structure against a template data set structure.
internal

%cstutil_cleanupcstsession(_cstClearCompiledMacros=0, _cstClearLibRefs=0, _cstResetSASAutos=0, _cstResetCmpLib=0, _cstResetFmtSearch=0, _cstResetSASOptions=1, _cstDeleteFiles=1, _cstDeleteGlobalMacroVars=0, _cstStd=, _cstStdVer=);
Cleans up after a SAS Clinical Standards Toolkit session.
external

%cstutil_CreateMetadataReport(_cstStandardTitle=, _cstValidationDS=, _cstValidationDSWhClause=, _cstMessagesDS=, _cstStdRefDS=, _cstReportOutput=, _cstCheckMDReport=N, _cstMessageReport=N, _cstStdRefReport=N, _cstRecordView=N);
Creates a report that documents the metadata of a process.
external

%cstutil_createreport(_cstSASReferencesDSet=, _cstResultsDSet=&_cstRptResultsDS, _cstMetricsDSet=&_cstRptMetricsDS, _cstReportErrorsOnly=N, _cstReportObs=, _cstReportByTable=N, _cstTableChecksDSet=, _cstTableChecksCode=, _cstKeepTableCheckList=N, _cstTableSubset=, _cstReportOutput=, _cstSummaryReport=Y, _cstIOReport=Y, _cstMetricsReport=Y, _cstGeneralResultsReport=Y, _cstCheckIDResultsReport=Y);
Creates a report that documents the data sets generated by a process.
internal

%cstutil_createsubdir(_cstSubDir=);
Creates a subdirectory on a computer that is not running Microsoft Windows.
internal

%cstutil_createsublists(_cstSupplementalVar=);
Creates work._cstsublists that has interpreted validation check metadata.
internal

%cstutil_createTempMessages(_cstCreationFlag=);
Creates a temporary Messages data set using the CST-FRAMEWORK messages.
internal

%cstutil_deleteDataSet(_cstDataSetName=, _cstLogging=0, _cstLoggingDS=);
Deletes a data set, if it exists.
external

%cstutil_getcstversion;
Returns the SAS Clinical Standards Toolkit product version.
internal

%cstutil_getRandomNumber(_cstVarname=);
Returns a four-digit random number that can be used in work data set names.
external

%cstutil_getsasreference(_cstStandard=, _cstStandardVersion=, _cstSASRefType=, _cstSASRefSubtype=, _cstSASRefsasref=, _cstSASRefmember=, _cstConcatenate=0, _cstFullname=0, _cstAllowZeroObs=0);
Gets row-level metadata from SASReferences, given the type and subtype.
internal

%cstutil_getsubjectcount(_cstDS=, _cstSubID=&_cstSubjectColumns);
Populates _cstMetricsCntNumSubj with the count of the number of subjects.
internal

%cstutil_internalmanageresults(_cstAction=);
Saves and restores process results macro variables.
internal

%cstutil_messagesdsattr;
Defines the column attributes of the Messages data set.
internal

%cstutil_metricsdsattr;
Defines the column attributes of the Metrics data set.
internal

%cstutil_parsecolumnscope(_cstScopeStr=, _cstOpSource=, _cstSublistNum=);
Parses _cstColumnScope to add or remove columns from _cstColumnMetadata.
internal

%cstutil_parsescopesegment(_cstPart=, _cstVarName=, _cstMessageID=CST0004, _cstLengthOverride=N);
Parses validation check metadata columns to handle extended values.
internal

%cstutil_parsetablescope(_cstScopeStr=, _cstOpSource=, _cstSublistNum=);
Parses _cstTableScope to add or remove columns from _ cstTableMetadata.
external

%cstutil_processsetup(_cstSASReferencesSource=SASREFERENCES, _cstSASReferencesName=sasreferences, _cstSASReferencesLocation=);
Sets up model-specific study metadata.
external

%cstutil_readcontrol;
Reads a single validation_control record and creates macro variables.
external

%cstutil_readxmltags(_cstXMLFilename=inxml, _cstXMLReporting=Results, _cstXMLElementDS=work.cstodmelements, _cstXMLAttrDS=work.cstodmattributes);
Creates data sets of element and attribute names from an XML file.
external

%cstutil_reportgeneralprocess;
Generates the General Process Reporting panel.
external

%cstutil_reportinputsoutputs;
Generates the Process Inputs/Outputs panel.
external

%cstutil_reportprocessmetrics;
Generates the Process Metrics panel.
external

%cstutil_reportprocessresults;
Generates the Process Results panel.
external

%cstutil_reportprocesssummary;
Generates the Process Summary panel.
external

%cstutil_reportsetup(_cstRptType=Metadata);
Sets up process and metadata reporting.
external

%cstutil_reporttabledata;
Supports table (domain) reporting by expanding process results.
internal

%cstutil_resultsdsattr;
Defines the column attributes of the Results data set.
internal

%cstutil_resultsdskeep;
Specifies the Results data set columns to keep in a DATA step.
internal

%cstutil_saveresults(_cstIncludeValidationMetrics=0);
Saves process results to the file or files specified in SASReferences.
internal

%cstutil_setcstgroot;
Sets the global macro variable _cstGRoot.
internal

%cstutil_setcstsroot;
Sets the global macro variable _cstSRoot.
internal

%cstutil_setmodel(_cstStd=&_cstStandard, _cstStdVer=&_cstStandardVersion);
Establishes the comparison reference metadata for a validation check.
internal

%cstutil_writecubexml(_cstXMLOut=, _cstEncoding=UTF-8, _cstMDPFile=, _cstDebug=);
Creates a temporary XML file that is used by the define.xml process.
internal

%cstutil_writemetric(_cstMetricParameter=, _cstResultID=, _cstResultSeqParm=, _cstMetricCnt=, _cstSrcDataParm=, _cstMetricsDSParm=&_cstMetricsDS);
Adds a single record to the Metrics data set based on parameter values.
internal

%cstutil_writeODMcubexml(_cstXMLOut=, _cstEncoding=UTF-8);
Creates a temporary XML file that is used in the derivation of an ODM XML file.
internal

%cstutil_writeresult(_cstResultID=, _cstValCheckID=, _cstResultParm1=, _cstResultParm2=, _cstResultSeqParm=1, _cstSeqNoParm=1, _cstSrcDataParm=, _cstResultFlagParm=0, _cstRCParm=0, _cstActualParm=, _cstKeyValuesParm=, _cstResultDetails=, _cstResultsDSParm=&_cstResultsDS);
Adds a single record to the Results data set based on parameter values.
external

%cstutiladddataset(_cstStd=, _cstStdVer=, _cstDS=, _cstInputDS=, _cstDSLabel=, _cstDSKeys=, _cstOverwrite=N);
Adds a data set to the global standards library or the sample library.
external

%cstutiladddscolumn(_cstStd=, _cstStdVer=, _cstDS=, _cstColumn=, _cstColumnLabel=, _cstColumnType=, _cstColumnLength=, _cstColumnFmt=, _cstColumnInitValue=);
Adds a column to a SAS Clinical Standards Toolkit data set.
external

%cstutilappendmetadatarecords(_cstStd=, _cstStdVer=, _cstDS=, _cstNewDS=, _cstUpdateDSType=MERGE, _cstOverwriteDup=N, _cstTestMode=Y);
Appends records to a SAS Clinical Standards Toolkit data set.
external

%cstutilbuildattrfromds(_cstSourceDS=, _cstAttrVar=);
Builds a DATA step ATTRIB statement based on columns in the input data set.
internal

%cstutilbuildmetadatafromsasrefs(cstSRefsDS=&_cstsasrefs, cstRefTabDS=work.reference_tables, cstRefColDS=work.reference_columns, cstSrcTabDS=, cstSrcColDS=);
Builds the framework reference_tables and reference_columns data sets.
external

%cstutilbuildstdvalidationcode(_cstStdDS=work._cstStandardsforIV, _cstSampleRootPath=, _cstSampleSASRefDSPath=, _cstSampleSASRefDSName=, _cstCallingDriver=Unspecified);
Generates the validation-specific macro _cstreadStds to build the workflow.
internal

%cstutilcheckforproblem(_cstRsltID=, _cstChkID=, _cstType=STD);
Handles any error condition that sets error condition _cst_rc to 1.
internal

%cstutilcheckjava;
Determines whether issues related to Java exist in the previous DATA step.
external

%cstutilcheckwriteaccess(_cstFileType=, _cstFilePath=, _cstFileRef=);
Checks for Write access for an output object.
external

%cstutilcomparestructure(_cstReturn=_cst_rc, _cstReturnMsg=_cst_rcmsg, _cstBaseDSName=, _cstCompDSName=, _cstResultsDS=work._cstCompareStructure);
Compares the metadata structure of two data sets.
internal

%cstutilcreateattribfromds(_cstDataSetName=, _cstAttrFileref=, _cstRptType=LOG);
Creates a DATA step ATTRIB statement for all columns in a specified data set.
external

%cstutilcreatetablesfrommetadata(_cstReturn=_cst_rc, _cstReturnMsg=_cst_rcmsg, _cstTableMD=, _cstColumnMD=, _cstOutputLibrary=, _cstNumObs=0, _cstWhereClause=);
Creates table shells from metadata.
external

%cstutildeletedscolumn(_cstStd=, _cstStdVer=, _cstDS=, _cstColumn=, _cstMustBeEmpty=Y, _cstTestMode=Y);
Deletes a column from a SAS Clinical Standards Toolkit data set.
external

%cstutildeletemetadatarecords(_cstStd=, _cstStdVer=, _cstDS=, _cstDSIfClause=, _cstTestMode=Y);
Deletes an observation from a SAS Clinical Standards Toolkit data set.
internal

%cstutildropmissingvars(_cstDataSetName=, _cstDataSetOutName=, _cstNoDrop=);
Drops variables from a data set that have only missing values.
external

%cstutilfindvalidfile(_cstFileType=, _cstFilePath=, _cstFileRef=);
Checks whether a folder, file, data set, catalog, or catalog member exists.
internal

%cstutilgetattribute(_cstDataSetName=_last_, _cstVarName=, _cstAttribute=);
Gets attribute information from a data set or variable.
external

%cstutilgetdslock(_cstLockDS=, _cstWaitTime=60);
Attempts to get a data set lock to support subsequent data set updates.
external

%cstutillogevent(_cstLockDS=, _cstUpdateDS=);
Logs a file operation in the specified log file.
external

%cstutilmodifycolumnattribute(_cstStd=, _cstStdVer=, _cstDS=, _cstColumn=, _cstAttr=, _cstAttrValue=, _cstTestMode=Y);
Modifies column attributes of a SAS Clinical Standards Toolkit data set.
internal

%cstutilnobs(_cstDataSetName=_last_);
Returns the number of observations in a data set or an error.
external

%cstutilprocessfailed(_cstResDS=&_cstResultsDS);
Returns a boolean to indicate whether a process failed.
internal

%cstutilprocessxmllog(_cstReturn=_cst_rc, _cstReturnMsg=_cst_rcmsg, _cstLogXMLPath=, _cstScope=USER);
Processes the XML log file that was created by the Java XMLTransformer process.
internal

%cstutilsetcstgroot93;
Sets the global macro variable _cstGRoot for SAS 9.3.
internal

%cstutilsetcstsroot93;
Sets the global macro variable _cstSRoot for SAS 9.3.
internal

%cstutiltrimcharvars(_cstDataSetName=, _cstDataSetOutName=, _cstNoTrim=);
Trims character variables to their minimum lengths.
external

%cstutilupdatemetadatarecords(_cstStd=, _cstStdVer=, _cstDS=, _cstDSIfClause=, _cstColumn=, _cstValue=, _cstTestMode=Y);
Updates an observation in a SAS Clinical Standards Toolkit data set.
external

%cstutilvalidatesasreferences(_cstDSName=&_cstSASRefs, _cstStandard=CST-FRAMEWORK, _cstStandardversion=1.2, _cstSASRefsGoldStd=, _cstallowoverride=, _cstResultsType=LOG, _cstPreAllocated=N, _cstVerbose=N);
Validates the structure and content of a SASReferences data set.
external

%cstutilvalidationsummary(_cstResDS=&_cstResultsDS, _cstProcessSummary=N, _cstSeverityList=Note Warning Error);
Summarizes the contents of the validation process Results data set.
internal

%cstutilwriteresultsintro(_cstProcessType=REPORTING, _cstPgm=);
Adds intro records to the Results data set.
external

%cstutilxmlvalidate(_cstSASReferences=&_cstSASRefs, _cstLogLevel=info, _cstCallingPgm=None or unspecified);
Performs XML schema-level validation on a supported XML standard file.
external

%cstvalidate(_cstCallingPgm=Unspecified, _cstReportOverride=N);
Validates SAS Clinical Standards Toolkit metadata.

Macro Detail

%cst_createdsfromtemplate(_cstStandard=, _cstStandardVersion=, _cstType=, _cstSubType=, _cstOutputDS=, _cstOutputDSLabel=, _cstResultsOverrideDS=);

[ Exposure: external ]
Creates a zero-observation data set that is based on a template.

The template is provided by a registered standard.

          
History:
   2013-07-30
Added look-through capability. If a template is not found
for any non-Framework standard, the cross-standard Framework
template library is also searched.
Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstStandard - - required - The name of a registered standard.
_cstStandardVersion - - optional - The version of the standard that the
        data set is created from. If this is omitted, the default
        version for the standard is used. If a default version is not
        defined, an error is generated.
_cstType - - required - The type of data set to create. This value comes
        from the TYPE column in the SASReferences file for the standard-
        version combination.
_cstSubType - - optional - The subtype for the type. This value comes
        from the SUBTYPE column in the SASReferences file for the
        standard-version combination. If the type has no subtypes, the
        value can be omitted. Otherwise, it must be specified.
_cstOutputDS - - required - The name of the data set to create.
_cstOutputDSLabel - - optional - The label of the data set to create.
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If omitted, the Results data set
        that is specified by &_cstResultsDS is used.
File: cst_createdsfromtemplate.sas
First available in version: 1.5

%cst_createStudyFromStandard(_cstModel=, _cstVersion=, _cstStudyRootPath=);

[ Exposure: external ]
Creates a study from the selected model and version.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session.
        Values: 1 | 0
_cstMessages - Cross-standard work messages data set.
_cstResultSeq - Results: Unique invocation of check.
_cstResultsDS - Results data set.
_cstSeqCnt - Results: Sequence number within _cstResultSeq.
_cst_MsgID - Results: Result or validation check ID.
_cst_MsgParm1 - Messages: Parameter 1.
_cst_MsgParm2 - Messages: Parameter 2.
_cst_rc - Task error status.
Parameters:
_cstModel - - required - The name of the data model to use for this study.
_cstVersion - - required - The version of the data model to use for this
        study.
_cstStudyRootPath - -required - The physical path location in which to
        create the study.
File: cst_createstudyfromstandard.sas
First available in version: 1.2

%cst_createTablesForDataStandard(_cstStandard=, _cstStandardVersion=, _cstOutputLibrary=, _cstWhereClause=, _cstResultsOverrideDS=, _cstNumObs=0);

[ Exposure: external ]
Creates tables from registered reference metadata.

This macro generates all of the table shells that are defined for a standard
that is registered and that is a data standard. The table shells are stored in
a library specified by the caller.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
        Values: 1 | 0
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstStandard - - required - The name of the registered standard.
_cstStandardVersion - - optional - The version of the standard from which
        the data set is created. If this parameter is omitted, the default
        version for the standard is used. If a default version is not
        defined, an error is generated.
_cstOutputLibrary - - required - The libname in which the table shells
        are created.
_cstWhereClause - - optional - A valid SAS WHERE clause used in the PROC
        sort to enable the creation of subset by table. By default, no
        WHERE clause is submitted. This parameter relies on a syntactically
        valid WHERE statement.
        Example:
        %nrstr(where upcase(tablecore) ne 'EXT')
        Default: <blank>
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        a Results data set to create. If this parameter is omitted, the
        Results data set specified by &_cstResultsDS is used.
_cstNumObs - - optional - The number of records in the data sets to
        create. By default, zero-observation data sets are created. If you
        specify a value other than 0, the data sets to create contain one
        observation with all fields missing.
        Default: 0
File: cst_createtablesfordatastandard.sas
First available in version: 1.2

%cst_deleteProperties(_cstPropertiesLocation=, _cstLocationType=, _cstResultsOverrideDS=);

[ Exposure: external ]
Reads a properties file or data set and clears global macros, accordingly.

A properties file must have the format name=value. A data set must have a
character field for name and value. A line in which the first non-blank
character is # or ! is ignored. A data set can have a comment field, but this
field is ignored.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstPropertiesLocation - - required - The location of the properties
        file. The format depends on the value of _cstLocationType.
_cstLocationType - - required - The format for the value of
        _cstPropertiesLocation. Valid Values are:
        PATH: The path to the properties file.
        FILENAME: A valid, assigned SAS filename to the properties file.
        DATA: A (libname.)membername of a SAS data set that contains the
        properties.
        Values: PATH | FILENAME | DATA
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_deleteproperties.sas
First available in version: 1.2

%cst_getRegisteredStandards(_cstOutputDS=, _cstResultsDS=);

[ Exposure: external ]
Generates a data set that contains the installed models and versions.

Expected Macro Variables:
_cst_rc - Task error status
Parameters:
_cstOutputDS - - required - The libname.memname of the data set to create.
_cstResultsDS - - optional - The results that were created.
File: cst_getregisteredstandards.sas
First available in version: 1.2

%cst_getStandardSASReferences(_cstStandard=, _cstStandardVersion=, _cstOutputDS=, _cstResultsOverrideDS=);

[ Exposure: external ]
Retrieves the global SASReference records for a standard.

If this macro succeeds, the global variable _cst_rc is set to 0. If it fails,
_cst_rc is set to 1. The Results data set contains more information as to the
cause of the failure.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
        Values: 1 | 0
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstStandard - - required - The name of the registered standard.
_cstStandardVersion - - optional - The version of the standard for which
        the caller wants to retrieve the global SASReferences. This can be
        omitted if the caller is requesting the default version for the
        standard.
_cstOutputDS - - required - The (libname.)member name of the output data
        set to create.
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_getstandardsasreferences.sas
First available in version: 1.2

%cst_getstandardsubtypes(_cstStandard=CDISC-TERMINOLOGY, _cstOutputDS=, _cstResultsDS=);

[ Exposure: external ]
Creates a data set that contains the installed Clinical Terminology subtypes.

Examples of the subtypes are SDTM, CDASH, ADAM, or any user customizations.

Expected Macro Variables:
_cst_rc - Task error status
Parameters:
_cstStandard - - required - The name of the registered standard.
        Values: CDISC-TERMINOLOGY
        Default: CDISC-TERMINOLOGY
_cstOutputDS - - required - The libname.memname of the data set to create.
_cstResultsDS - - optional - The results that were created.
File: cst_getstandardsubtypes.sas
First available in version: 1.4

%cst_getStatic(_cstName=, _cstVar=);

[ Exposure: external ]
Returns constant values that are used by other macros.

&macvar _cstGRoot Root path of the global standards library

          
History:
   2013-09-16
Added CST_LOGGING_PATH | CST_LOGGING_DS
Parameters:
_cstName - - required - The name of the value to retrieve.
        Values:
        CST_DSTYPE_UTTABLE | CST_DSTYPE_UTCOLUMN | CST_DSTYPE_UTLOOKUP |
        CST_DSTYPE_SASREFS | CST_DSTYPE_STANDARD | CST_DSTYPE_STANDARDBASE |
        CST_DSTYPE_STANDARDL10N | CST_DSTYPE_STANDARDMACROS |
        CST_DSTYPE_STANDARDSASREFS | CST_DSTYPE_RESULT | CST_DSTYPE_LOCALIZATION |
        CST_DSTYPE_MESSAGES | CST_DSTYPE_METRICS | CST_DSTYPE_ |
        CST_GLOBALMD_PATH | CST_GLOBALMD_REGSTANDARD | CST_GLOBALMD_SASREFS |
        CST_GLOBALMD_LOOKUP | CST_GLOBALMD_MVARS | CST_GLOBALMD_MVARVALS |
        CST_GLOBALMD_TRANSFORMSXML | CST_GLOBALSTD_PATH | CST_GLOBALXSD_PATH |
        CST_GLOBALXSL_PATH | CST_CT_SUBTYPES_DATA | CST_SASREF_TYPE_SOURCEDATA |
        CST_SASREF_TYPE_REFMD | CST_SASREF_SUBTYPE_TABLE |
        CST_SASREF_SUBTYPE_COLUMN | CST_SASREF_SUBTYPE_LOOKUP |
        XML_SASREF_TYPE_REFXML | XML_SASREF_TYPE_EXTXML |
        XML_SASREF_SUBTYPE_XML | XML_SASREF_SUBTYPE_STYLESHEET
        XML_JAVA_PARAMSCLASS | XML_JAVA_IMPORTCLASS |
        XML_JAVA_EXPORTCLASS | XML_JAVA_PICKLIST
        CST_LOGGING_PATH | CST_LOGGING_DS
_cstVar - - optional - The macro variable to populate with the value.
File: cst_getstatic.sas
First available in version: 1.2

%cst_insertStandardSASRefs(_cstSASReferences=, _cstOutputDS=, _cstAddRequiredCSTRefs=0, _cstResultsOverrideDS=);

[ Exposure: external ]
Inserts missing standards information into a SASReferences file.

Where a SASReferences file uses a standard, it is possible to specify only the
standard, standardVersion, type, and subType for information that has been
registered by the standard. Calling this macro supplies the missing
information. If a standardVersion is not specified, the information for the
default version of that standard is used.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSASRefsLoc - SASReferences file location
_cstSASRefsName - SASReferences file name
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstSASReferences - - optional - The(libname.)member that points to a
        SASReferences file to complete. If this parameter is not specified,
        _cstSASRefsLoc and _cstSASRefsName can be used to specify the
        SASReferences file information. If none of the other mechanisms are
        specified or available, _cstSASRefs is used.
_cstOutputDS - - required - The output data set to create that contains
        the completed information.
_cstAddRequiredCSTRefs - - optional - Add a default framework messages
        data set record, if needed. 0 = no, 1 = yes.
        Values: 0 | 1
        Default: 0
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_insertstandardsasrefs.sas
First available in version: 1.2

%cst_registerStandard(_cstRootPath=, _cstControlSubPath=, _cstStdDSName=, _cstStdSASRefsDSName=, _cstStdLookupDSName=);

[ Exposure: external ]
Registers a new standard within the global standards library.

This macro registers a new standard and standardversion to the SAS Clinical
Standards Toolkit. The minimum information that is required to register a new
standard is defined in the macro parameters.rdversion from the
StandardSASReferences data set. The data sets defined by _cstStdDSName and
_cstStdSASRefsDSName have the same structure as the data sets in the global
standards library metadata directory.

Expected Macro Variables:
_cst_rc - Task error status
Parameters:
_cstRootPath - - required - The root path for the directory structure of
        the standard.
_cstControlSubPath - - required - The path, relative to _cstRootPath, of
        the directory that contains the metadata files for a standard
        (normally called standard and standardSASReferences).
_cstStdDSName - - required - The member name of the data set that
        contains metadata about the standard to install.
_cstStdSASRefsDSName - - required - The member name of the data set
        that contains the metadata about the standardSASReferences data set
        to install.
_cstStdLookupDSName - - optional - The member name of the data set
        that contains the metadata about the standardlookup data set
        to install.
File: cst_registerstandard.sas
First available in version: 1.2

%cst_setProperties(_cstPropertiesLocation=, _cstLocationType=, _cstResultsOverrideDS=);

[ Exposure: external ]
Reads a properties file or data set and sets global macros, accordingly.

A properties file must have the format name=value. A data set must have a
character field for name and value. A line in which the first non-blank
character is # or ! is ignored. A data set can have a comment field, but this
field is ignored.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cst_rc - Task error status
Parameters:
_cstPropertiesLocation - - required - The location of the properties
        file. The format depends upon the value of _cstLocationType.
_cstLocationType - - required - The format for the value of
        _cstPropertiesLocation. Valid values are:
        PATH: The path to a properties file.
        FILENAME: A valid, assigned SAS filename to the properties file.
        DATA: A (libname.)membername of a SAS data set that contains the
        properties.
        Values: PATH | FILENAME | DATA
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_setproperties.sas
First available in version: 1.2

%cst_setStandardProperties(_cstStandard=, _cstStandardVersion=, _cstSubType=, _cstResultsOverrideDS=);

[ Exposure: external ]
Sets specific standard global macro variables from properties files.

This macro sets properties (global macro variables) that are supplied as part
of a standard. When a standard is registered, it most likely also registers
values in a SASReferences file. A number of these values might be for
properties files that are used by the standard, or provided by the standard to
help you. For example, CST_FRAMEWORK provides a property subType of 'required'
that points to a properties file that has default settings for required
properties. You can call this method using this code to set these properties:

%cst_setStandardProperties(
_cstStandard=CST-FRAMEWORK,
_cstStandardVersion=1.2,
_cstSubType=initialize);

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
        Values: 1 | 0
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstStandard - - required - The name of the registered standard.
_cstStandardVersion - - optional - The version of the standard. If the
        standard has a default set, this parameter is optional. Otherwise,
        it is required.
_cstSubType - - required - The name of the properties subtype from which
        to read and set properties.
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_setstandardproperties.sas
First available in version: 1.2

%cst_setStandardVersionDefault(_cstStandard=, _cstStandardVersion=, _cstResultsOverrideDS=);

[ Exposure: external ]
Sets the default version for a registered standard.

This macro also resets any previous default version for the standard.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstStandard - - required - The name of the registered standard.
_cstStandardVersion - - required - The version of the standard from which
        the data set is created. If this parameter is omitted, the default
        version for the given standard is used. If a default version is not
        defined, an error is generated.
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_setstandardversiondefault.sas
First available in version: 1.2

%cst_unregisterStandard(_cstStandard=, _cstStandardVersion=, _cstResultsOverrideDS=);

[ Exposure: external ]
Unregisters an existing standard from the global standards library.

This macro unregisters a specific standard and standardversion, removes it
from the global standards library metadata Standards data set, and removes all
records for that standard and standardversion from the StandardSASReferences
and StandardLookup data sets.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstStandard - - required - The name of the standard.
_cstStandardVersion - - required - The version of the standard.
_cstResultsOverrideDS - - optional - The (libname.)member that refers to
        the Results data set to create. If this parameter is omitted, the
        Results data set that is specified by &_cstResultsDS is used.
File: cst_unregisterstandard.sas
First available in version: 1.2

%cst_unsetProperties(_cstPropertiesLocation=, _cstLocationType=, _cstResultsOverrideDS=);

[ Exposure: external ]
Reads a properties file or data set and clears global macros, accordingly.

This macro reads a properties file or data set and clears global macros.
A properties file must have the format name=value. A data set must have a
character field for name and value. A line in which the first non-blank
character is # or ! is ignored. A data set can have a comment field, but
this field is ignored.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstPropertiesLocation - - required - The location of the properties
        file. The format depends on the value of _cstLocationType.
_cstLocationType - - required - The format for the value of
        _cstPropertiesLocation. Valid values are:
        PATH: The path to the properties file.
        FILENAME: A valid, assigned SAS filename to the properties file.
        DATA: A (libname.)membername that refers to a SAS data set that
        contains the properties.
        Values: PATH | FILENAME | DATA
_cstResultsOverrideDS - - optional - The (libname.)member that refers
        to the Results data set to create. If this parameter is omitted,
        the Results data set that is specified by &_cstResultsDS is used.
File: cst_unsetproperties.sas
First available in version: 1.2

%cstcheck_column(_cstControl=);

[ Exposure: external ]
Identifies invalid column values or attributes.

NOTE: This macro requires use of _cstCodeLogic at a statement level in a SAS
DATA step context. _cstCodeLogic identifies records in error by setting
_cstError=1.

Example validation checks that use this macro include:
Value of Visit Number is formatted to > 3 decimal places
A column character value is not left-justified
Study day of Visit/Collection/Exam (**DY) equals 0
Length of **TEST > 40

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_column.sas
Version: 1.2

%cstcheck_columncompare(_cstControl=);

[ Exposure: external ]
Compares column values.

This macro is similar to cstcheck_multicolumn, but provides additional
functionality in the form of step-level code (for example, optional reference
to column metadata).

NOTE: This macro requires use of _cstCodeLogic at a SAS DATA step level (that
is, a full DATA step or PROC SQL invocation). _cstCodeLogic creates a
Work file (_cstproblems) that contains records in error.

Example validation checks that use this macro:
**DOSE and **DOSU inconsistencies for Expected columns

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_columncompare.sas
First available in version: 1.2

%cstcheck_columnexists(_cstControl=);

[ Exposure: external ]
Determines whether columnScope columns exist in the tableScope tables.

This macro determines whether one or more of the columns defined in
columnScope exist in each of the tables defined in tableScope.

NOTE: By default, this check does not require the use of codeLogic. If the
check metadata includes a non-null value of codeLogic, it is used. If
codeLogic is used, it must populate the macro variable _cstDataRecords
with a count that represents the number of columns found in the specific
table defined by _cstDSName and _cstDomainOnly. A _cstDataRecords count
of 0 is reported as an error.

NOTE: Care must be exercised when columnScope contains either multiple
columns (for example, TRTP+TRTPn) or a column with wildcarding (for
example, TRT**P). In both cases, the default code reports an error ONLY
if NONE of the columns are found.

NOTE: This is a metadata-only check against column and table metadata files.
No source data sets are referenced.

Example validation checks that use this macro:
ADAM0090 - (for BDS data sets) does the column TRTP exist?

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_columnexists.sas
First available in version: 1.4

%cstcheck_columnvarlist(_cstControl=);

[ Exposure: external ]
Compares columns within the same data set or across multiple data sets.

NOTE: As a general rule, this macro expects a check metadata columnScope
syntax of {_cstList:var1+var2+var3...varn} for within-data-set
assessments and {_cstList:var1...varn}{_cstList:var1...varn} for
multi-data-set assessments.

NOTE: This macro requires use of _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation). _cstCodeLogic creates
a Work file (_cstproblems) that contains the records in error.
_cstCodeLogic MUST handle any data set joins when multiple data sets are
involved in the column comparisons.

Example validation checks that use this macro:
ADAM0152 - (for BDS data sets) BASE is populated and BASE is not equal to
AVAL where ABLFL is equal to "Y" for a given value of PARAM and BASETYPE

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_columnvarlist.sas
First available in version: 1.4

%cstcheck_comparedomains(_cstControl=);

[ Exposure: external ]
Compares column values in one domain with the values in another domain.

This macro compares values for one or more columns in one domain with the
values for the same columns in another domain. For example, the USUBJID value
in any domain does not have a matching USUBJID value in the DM domain.

Note: This macro requires use of _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation). _cstCodeLogic
creates a work file (_cstproblems) that contains records in error.

Example validation checks that use this macro:
Unique USUBJID+VISIT+VISITNUM combinations in each domain not found in SV

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_comparedomains.sas
First available in version: 1.2

%cstcheck_crossstdcomparedomains(_cstControl=);

[ Exposure: external ]
Compares column values in one table with the columns in another domain.

This mcro compares the values for one or more columns in one table against
either the same columns in another domain in another standard, or compares
values against metadata from the comparison standard.

NOTE: This macro requires the use of _cstCodeLogic as a full DATA step or PROC
SQL invocation. This DATA step or PROC SQL invocation assumes as input a
Work copy of the column metadata data set that is returned by the
cstutil_buildcollist macro. Any resulting records in the derived data
set represent errors to report.

Example validation checks that use this macro:
ADaM subject not found in SDTM dm domain
ADaM SDTM domain reference (for traceability) but SDTM domain in unknown

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstcrossstd - Name of the comparison standard
_cstcrossstdver - Version of the comparison standard
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_crossstdcomparedomains.sas
First available in version: 1.4

%cstcheck_crossstdmetamismatch(_cstControl=);

[ Exposure: external ]
Identifies inconsistencies between metadata across registered standards.

NOTE: This macro requires the use of _cstCodeLogic as a full DATA step or PROC
SQL invocation. This DATA step or PROC SQL invocation assumes as input a
Work copy of the column metadata data set that is returned by the
cstutil_buildcollist macro. Any resulting records in the derived data
set represent errors to report.

Assumptions:
1. No data content is accessed for this check.
2. Both study and reference metadata are available to assess compliance.
3. _cstProblems includes two columns (or more, if needed):
&_cstStMnemonic._value (for example, ADaM_value that contains the value
of the column of interest from the primary standard)
&_cstCrMnemonic._value (for example, SDTM_value that contains the value
of the column of interest from the comparison standard)
The mnemonics are from the global standards library data set.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstcrossstd - Name of the comparison standard
_cstcrossstdver - Version of the comparison standard
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_crossstdmetamismatch.sas
First available in version: 1.4

%cstcheck_dsmismatch(_cstControl=);

[ Exposure: external ]
Identifies data set mismatches in study and template metadata and source data.

This macro identifies data set mismatches between study and template metadata
and the source data library.

NOTE: This macro ignores tableScope and columnScope in the _cstControl input
data set.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_dsmismatch.sas
First available in version: 1.2

%cstcheck_metamismatch(_cstControl=);

[ Exposure: external ]
Identifies inconsistencies between study and reference column metadata.

This macro performs one of the following three assessments:
1: Using columnScope [][] sublist syntax, for the column specified in
sublist1, determines whether the corresponding column specified in
sublist2 exists. This assessment expects codeLogic to create
work._cstsublists.
Examples:
[TRT##PN][TRT##P] - If TRT01PN exists, TRT01P should exist
[STARTDT][CNSR] - STARTDT is present and CNSR is not present
2: Using any columnScope syntax OTHER THAN [][] sublist syntax, determines
whether columns with characteristics defined by columnScope syntax or in
codeLogic exist. This assessment expects codeLogic to create
work._cstnonmatch.
Example:
TRT**A - For columns starting with TRT and ending with A, some
condition specified in codeLogic occurs
3: When columnScope is null, processing is governed by codeLogic that
references the available table and column metadata. Either work._cstmatch
or work._cstnonmatch must be created by the check codeLogic.


NOTE: This macro requires use of _cstCodeLogic as a full SAS DATA step or PROC
SQL invocation. This DATA step or PROC SQL invocation assumes as input a
Work copy of the column metadata data set that is returned by the
cstutil_buildcollist macro. Any resulting records in the derived data
set represent errors to report.

Assumptions:
1. No data content is accessed for this check.
2. Both study and reference metadata must be present to assess compliance.
3. Current coding approach assumes:
- no reporting of non-errors
- reporting of study and reference metadata mismatches that prevent
compliance assessment

Example validation checks that use this macro:
Required column not found (Error)
Expected column not found (Warning)
Permissible column not found (Note)
Column found in data set but not in specification
Supplemental Qualifier data set without USUBJID column
Column metadata attribute differences (type, length, label, order, CT)

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_metamismatch.sas
First available in version: 1.2

%cstcheck_notconsistent(_cstControl=);

[ Exposure: external ]
Identifies inconsistent column values across records.

NOTE: This macro requires use of _cstCodeLogic at a SAS DATA step level (that
is, a full DATA step or PROC SQL invocation). _cstCodeLogic creates a
Work file (_cstproblems) that contains the records in error.

Example validation checks that use this macro:
**SEQ not consecutively incremented beginning at 1.
Standard units inconsistent within **TESTCD across records.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_notconsistent.sas
First available in version: 1.2

%cstcheck_notimplemented(_cstControl=);

[ Exposure: external ]
Placeholder to report that a check is not yet implemented.

Expected Macro Variables:
_cstResultsDS - Results data set
Parameters:
_cstControl - - required - The single observation data set that contains
        check-specific metadata
File: cstcheck_notimplemented.sas
First available in version: 1.3

%cstcheck_notincodelist(_cstControl=);

[ Exposure: external ]
Identifies column values inconsistent with controlled terminologies.

An example of an inconsistency is a **STAT value other than 'NOT DONE'.

NOTE: This macro requires reference to the SAS format search path built
based on type=FMTSEARCH records in the SASReferences control file.

Processing is based on the value of the check metadata LOOKUPTYPE field:

FORMAT: The code compares column values against a SAS format in the format
search path. codeLogic is optional. (That is, if you do not specify
any codeLogic, cstcheck_notincodelist uses default logic, which is
PROC SQL code that creates work._cstproblems if one or more errors
are detected). The SAS format is specified in the check metadata
LOOKUPSOURCE field.

DATASET: The code requires the use of codeLogic to create the data set
work._cstproblems. LOOKUPSOURCE must contain the reference data set
(for example, MedDRA for AE preferred term lookups) used in
codeLogic.Given that any reference dictionary with any given
structure can be used, it is incumbent on you to code correct joins
and lookup logic within codeLogic.

CODELIST: This functionality is deferred.

LOOKUP: The code compares column values against a standardlookup data set.
CodeLogic is required, and should create work._cstproblems if one
or more errors are detected.

METADATA: The code compares column values against a SAS format in the format
search path. codeLogic is optional. (That is, if you do not specify
any codeLogic, cstcheck_notincodelist uses default logic, which is
PROC SQL code that creates work._cstproblems if one or more errors
are detected). The SAS format is specified in the source column
metadata XMLCODELIST field.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_notincodelist.sas
First available in version: 1.2

%cstcheck_notsorted(_cstControl=);

[ Exposure: external ]
Identifies a domain that is not sorted by the keys defined in the metadata.

Example validation check that uses this macro:
Identifies domain in a table that is not correctly sorted.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_notsorted.sas
First available in version: 1.2

%cstcheck_notunique(_cstControl=);

[ Exposure: external ]
Assesses the uniqueness of records within data sets.

Each of these three assessments accesses different code sections within the
macro.

Assessment 1: Determine whether a data set is unique by a set of columns.
Data sets: It is assumed that if control column columnScope is blank,
code cycles through domains that are specified in control column
tableScope. Code identifies any records that are not unique by the
domain keys defined in the table-level metadata.
Multiple columns: This option allows the specification of a single set of
columns (in the form var1+var2+...varn). Code identifies any
records that are not unique by the specified set of columns within
each domain specified in tableScope. For the purposes of
reporting, the specified columns are treated as the domain keys.
No codeLogic is used or currently checked.
Assessment 2: For any subject, determine whether column values are unique.
Single columns: For single columns (for example, **SEQ), code checks for
uniqueness in USUBJID (except TSSEQ, in TSPARMCD). No codeLogic
is used or currently checked.
Assessment 3: Determine whether a combination of two columns has unique
values.
Column pairs: For multiple columns (for example, **TEST and **TESTCD), the
code checks that there are a unique set of values for the pair of
columns. These must be specified in the form of matching
columnScope sublists. Two, and only two, sublists can be
specified. No codeLogic is used or currently checked.
Assessment 4: Determine whether the values in one column (Column2) are
consistent with the values in another column (Column1).
Column pairs: For multiple columns (for example, **TESTCD and **STRESU),
the code checks that there is a unique value in Column2 for each
value of Column1. These must be specified in the form of matching
columnScope sublists. Two, and only two, sublists can be
specified. The first sublist contains Column1 (for example,
VSTESTCD), and the second sublist contains Column2 (for example,
VSSTRESU). codeLogic is required. It is the presence of codeLogic
that distinguishes Assessment 3 from Assessment 4.

The columnScope sublists must be bounded by brackets in this style:
[LBTEST+VSTEST][LBTESTCD+VSTESTCD]

The following limitations apply:
1. The two lists must resolve to the same number of columns.
2. The columns to be compared must be in the same data set.
3. The first item in list 1 is paired with the first item in list 2,
and so on.

Here are example combinations of tableScope and columnScope:

tableScope columnScope How code interprets
---------- ----------- ---------------------------------------------
ALL For all domains, determine whether each domain
is unique by its keys
FINDINGS [**TEST][**TESTCD] For all FINDINGS domains, **TEST and **TESTCD
must map 1:1
ALL **SEQ For all domains, check **SEQ for uniqueness
within USUBJID
DM Is DM unique by its keys (STUDYID+USUBJID)?
DV [DVTERM][DVDECOD] For DV, DVTERM and DVDECOD must map 1:1
SUPP** For all SUPP** domains, determine whether
records are unique by their keys
DV USUBJID+DVTERM For DV, determine whether records are unique
by USUBJID and DVTERM
ALL ALL Not supported thru the SAS Clinical Standards
Toolkit 1.4, this will signal in future release
a check for duplicate (non unique) records
across all columns.
For now, columnScope=_ALL_ will be treated
as columnScope=<blank>.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_notunique.sas
First available in version: 1.2

%cstcheck_recmismatch(_cstControl=);

[ Exposure: external ]
Identifies any record mismatches across domains.

NOTE: This macro requires use of _cstCodeLogic at a SAS DATA step level (that
is, a full DATA step or PROC SQL invocation). _cstCodeLogic creates a
Work file (_cstproblems) that contains the records in error.

Example CDISC SDTM validation checks that use this macro:
Comments, Relrec or Supplemental Qualifier RDOMAIN references to other
domains or domain records that do not exist

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_recmismatch.sas
First available in version: 1.2

%cstcheck_recnotfound(_cstControl=);

[ Exposure: external ]
Compares the consistency of one or more columns across two tables.

This macro also compares the consistency of one <table>.<column> with another
<table>.<column>. (For example, in CDISC SDTM, STUDYID in the TA domain does
not match STUDYID in the DM domain).

NOTE: This macro requires the use of _cstCodeLogic at a statement level in a
DATA step context. _cstCodeLogic identifies records in error by setting
_cstError=1.

NOTE: This macro requires that tableScope syntax specifies two sublists in the
form [DM][TA], comparing one or more columnScope fields across the tables
in these sublists. The current implementation only supports two sublists
with a single table specified.

CDISC SDTM example validation check that uses this macro:
DM subjects where no record for the subject is found in the DS table

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_recnotfound.sas
First available in version: 1.2

%cstcheck_violatesstd(_cstControl=);

[ Exposure: external ]
Identifies invalid column values that are defined in a reference standard.

NOTE: This macro requires use of _cstCodeLogic at a statement level in a SAS
DATA step context. _cstCodeLogic identifies records in errors by setting
_cstError=1.

Example validation checks that use this macro:
Identifies a null value found in a column where core attribute is REQ.
Identifies a null value found in a column where core attribute is EXP.
A column character value is not correctly upcased.
A numeric column column containing non-numeric entries.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_violatesstd.sas
First available in version: 1.2

%cstcheck_zeroobs(_cstControl=);

[ Exposure: external ]
Identifies a data set that contains zero observations.

Required file inputs:
Single-record control data set identified by control input parameter

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstMetricsNumSubj - Validation metrics: calculate number of subjects
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheck_zeroobs.sas
First available in version: 1.2

%cstcheckcompareallcolumns(_cstControl=);

[ Exposure: external ]
Compares all columns in one domain with the same columns in other domains.

This macro compares values for one or more columns in one domain with values
for those same columns in another domain. For example, an ADaM data set column
found with same name as an ADSL column but whose values do not match.

Note: This macro requires use of _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation). _cstCodeLogic creates
a work file (_cstproblems) that contains the records in error.

Example validation checks that use this macro:
ADaM column of ADSL origin but values do not match. COLUMNSCOPE=_ALL_ and
TABLESCOPE=[_ALL_-ADSL] [ADSL].

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata
File: cstcheckcompareallcolumns.sas
First available in version: 1.5

%cstcheckentitynotfound(_cstControl=);

[ Exposure: external ]
Reports that a SAS Clinical Standards Toolkit entity cannot be found.

This macro reports that a SAS Clinical Standards Toolkit entity (typically a
file, folder, or column) cannot be found.

NOTE: The file or folder reference might be embedded within a specific
SASReferences data set, too.

NOTE: By default, this check does not require the use of codeLogic. If the
check metadata includes a non-null value of codeLogic, the value is used.
If codeLogic is used, it must create work._cstproblems that has one
record per problem file or column. The macro variable _cstDataRecords
is populated based on the number of work._cstproblems records.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata
File: cstcheckentitynotfound.sas
First available in version: 1.5

%cstcheckforeignkeynotfound(_cstControl=);

[ Exposure: external ]
Compares the consistency of one or more columns across two tables.

This macro comparises the consistency of one <table>.<column> with another
<table>.<column>. (For example, in CDISC CRT-DDS, ItemGroupDefItemRefs.ItemOID
does not match any ItemDefs.OID).

The column in the first table is a foreign key that points to a primary key
in the second table.

The column in the second table is must be a key.

NOTE: This macro requires the use of _cstCodeLogic at a statement level in a
DATA step context. _cstCodeLogic identifies records in error by
setting _cstError=1.

NOTE: This macro requires that tableScope syntax specifies two sublists in the
form [ItemGroupDefItemRefs][ItemDefs], which compares one or more
columnScope fields across the tables in these sublists. Only two
sublists with a single table specified is supported.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetrics - Enables or disables metrics reporting
_cstMetricsCntNumRecs - Validation metrics: number of records evaluated
_cstMetricsNumRecs - Validation metrics: calculate number of records
        evaluated
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstrunstd - Primary standard
_cstrunstdver - Version of the primary standard
Parameters:
_cstControl - - required - The single-observation data set that contains
        check-specific metadata.
File: cstcheckforeignkeynotfound.sas
First available in version: 1.5

%cstcheckutil_formatlookup(_cstDSN=&_cstDSName, _cstDomOnly=, _cstCol1=&_cstColumn, _cstCol2=, _cstCol2Value=);

[ Exposure: internal ]
Performs a lookup in a format value column.

This macro creates work._cstproblems that contains records that are included
in the data set that is specified by _cstSourceDS, where the value of a column
is not found in the format value column.

For example, in the TS domain, TSPARMCD has a value of SEX. The $SEXPOP format
is associated with this variable and has these values: BOTH, F, and M. TSVAL
has to contain one of these values to be correct. Otherwise, an error condition
exists.

NOTE: This macro is called within _cstCodeLogic at a DATA step level (that is,
a full DATA step or PROC SQL invocation).

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
Parameters:
_cstDSN - - required - The domain and table that contain _cstCol2.
_cstDomOnly - - required - The alias for _cstDSN (only domain).
_cstCol1 - - required - The variable that contains the value to check
        (TSVAL).
_cstCol2 - - required - The variable that defines the record to check
        (TSPARMCD).
_cstCol2Value - - required - The value from _cstCol2.
File: cstcheckutil_formatlookup.sas
First available in version: 1.3

%cstcheckutilcheckfile(_cstSourceDS=&_cstDSName, _cstSourceC1=&_cstColumn1, _cstSourceC2=&_cstColumn2, _cstSourceDir=, _cstSourceFileRef=, _cstWhereStatement=);

[ Exposure: internal ]
Determines whether a file exists as defined by columns in a source data set.

The file is specified by _cstSourceFileRef and the directory is specified by
_cstSourceDir. The determination is based on the type of standard as defined
by ISDATASTANDARD, ISXMLSTANDARD, ISCSTFRAMEWORK, or SUPPORTSVALIDATION.

_cstSourceDir is appended to the ROOTPATH value from the glmeta.standards data
set. If the file does not exist, this macro creates work._cstproblems.

NOTE: This macro is called within _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation) and is used within
the cstcheck_columncompare macro.

Expected Macro Variables:
_cst_rc - Task error status
Parameters:
_cstSourceDS - - required - The source data set to evaluate by the
        validation check.
        Default: &_cstDSName
_cstSourceC1 - - required - _cstColumn1 macro variable value that
        represents the ROOTPATH column from the glmeta.standards data set.
        Default: &_cstColumn1
_cstSourceC2 - - required - The _cstColumn2 macro variable value that
        represents the ISDATASTANDARD, ISXMLSTANDARD, ISCSTFRAMEWORK, or
        SUPPORTSVALIDATION column from the glmeta.standards data set.
        Default: &_cstColumn2
_cstSourceDir - - optional - The directory path that is appended to
        ROOTPATH.
_cstSourceFileRef - - required - The file to look up. For example,
        standardlookup.sas7bdat.
_cstWhereStatement - - optional - A SAS WHERE statement to subset
        _cstSourceDS. For example, WHERE standard="CDISC-ADAM".
File: cstcheckutilcheckfile.sas
First available in version: 1.5

%cstcheckutilcheckfolder(_cstSourceDS=&_cstDSName, _cstSourceC1=&_cstColumn1, _cstSourceC2=&_cstColumn2, _cstWhereStatement=);

[ Exposure: internal ]
Determines whether a folder exists as defined by columns in a source data set.

If the folder specified in _cstSourceC1 does not exist, this macro creates
work._cstproblems.

NOTE: This macro is called within _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation) and is used within
the cstcheck_columncompare macro.

Expected Macro Variables:
_cst_rc - Task error status
Parameters:
_cstSourceDS - - required - The source data set to evaluate by the
        validation check glmeta.standards data set.
        Default: &_cstDSName
_cstSourceC1 - - required - The _cstColumn1 macro variable value that
        represents the ROOTPATH column from the glmeta.standards data set.
        Default: &_cstColumn1
_cstSourceC2 - - required - The _cstColumn2 macro variable value that
        represents the STANDARDS column for reporting purposes only.
        Default: &_cstColumn2
_cstWhereStatement - - optional - A SAS WHERE statement to subset
        _cstSourceDS. For example, WHERE standard="CDISC-ADAM".
File: cstcheckutilcheckfolder.sas
First available in version: 1.5

%cstcheckutilcheckstructure(_cstSourceDS=&_cstTableScope, _cstStndrd=&_cstStandard, _cstStndrdVersion=&_cstStandardVersion, _cstFileType=DATASET, _cstColumn=, _cstRefColumn=, _cstCmpRc=16);

[ Exposure: internal ]
Compares the structure of data sets against a template.

This macro compares the structure of data sets referenced within a
StandardSASReferences data set or a SASReferences data set against a template.

The structure of the data set is specified by the TYPE, SUBTYPE, SASREF, and
MEMNAME columns that are specified by _cstSourceDS. Using this information,
a call to cstutil_getsasreference retrieves the associated lookup data set to
provide the template data set location. The referenced data set is compared to
the template data set using cstutilcomparestructure. If the structure does not
conform, this macro creates work._cstproblems.

NOTE: This macro is called within _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQLinvocation) and is used within the
cstcheck_dsmismatch macro.

Expected Macro Variables:
_cstDSLookup - Name of _cstSourceDS data set
_cstLookupDS - Data set associated with _cst_rc
_cstLookupLB - - Libname retrievedTask error status
_cstMemname - - Filename retrieved from memname column in _cstSourceDS
_cstNumObs - - Number of observations from _cstSourceDS data set that
        match _cstFileType
_cstTemplateMemname - - Name of template returned from &_cstLookupDS
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstSourceDS - - required - The source data set to evaluate by the
        validation check.
        Default: &_cstTableScope
_cstStndrd - - required - The standard under investigation, CST-FRAMEWORK.
        Default: &_cstStandard
_cstStndrdVersion - - required - The version of the standard.
        Default: &_cstStandardVersion
_cstFileType - - required - The FILETYPE column value from the data set
        that is specified by _cstSourceDS (folder, dataset, catalog, or
        file).
        Default: DATASET
_cstColumn - - required - The SAS Clinical Standards Toolkit column name
        value in the StandardLookup data set to use to filter the template
        information.
_cstRefColumn - - optional - The associated SAS Clinical Standards Toolkit
        column name in the StandardLookup data set to use to further filter
        the template information, if needed.
_cstCmpRc - - required - The minimum cstutilcomparestructure returncode
        to consider an error. For more information, see the documentation
        for the cstutilcomparestructure macro.
        _cstCmpRc=16: ignore labels, formats, and informat differences
        Default: 16
File: cstcheckutilcheckstructure.sas
First available in version: 1.5

%cstcheckutilfindsasrefsfile(_cstSASRefsFile=&_cstDSName, _cstStdsDS=glmeta.standards, _cstFTypes=FILE FOLDER CATALOG, _cstOverrideUnresolvedMacro=N);

[ Exposure: internal ]
Determines whether files in the referenced SASReferences data set exist.

This macro determines whether the specified files in the referenced
SASReferences data set exist.

NOTE: This macro is called within _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation) and is used within the
cstcheckentitynotfound macro. It creates and populates work._cstproblems,
which is returned to the calling check macro for reporting purposes.

Expected Macro Variables:
_cstLRECL - Logical record length setting for filename statement
_cstValidationStd - Standard of _cstSASRefsFile
_cstValidationStdVer - StandardVersion of _cstSASRefsFile
_cst_rc - Task error status
Parameters:
_cstSASRefsFile - - required - The SASReferences data set to evaluate.
        Default: &_cstDSName (passed from calling check macro)
_cstStdsDS - - optional - The list of supported standards to use for
        this check. If no data set is specified, all records in the
        glmeta.standards data set are used. This might result in false
        positive errors, especially for SAS catalogs, because required
        librefs might not have been allocated. The supported standards data
        set must include the Standard, StandardVersion, and RootPath
        columns.
        Default: glmeta.standards
_cstFTypes - - required - The set of SASReferences file types of
        interest (uppercased values of sasreferences.filetype).
        Default: FILE FOLDER CATALOG
        NOTE: Data sets and data views are not supported.
_cstOverrideUnresolvedMacro - - optional - Do not report unresolved
        macro variables in the entity path as a problem (Y).
        Values: N | Y
        Default: N
File: cstcheckutilfindsasrefsfile.sas
First available in version: 1.5

%cstcheckutillookupvalues(_cstStdsDS=glmeta.standards);

[ Exposure: internal ]
Determines whether metadata column values are in the StandardLookup data set.

This macro determines whether metadata column values for discrete columns are
in the StandardLookup data set.

NOTE: This macro is called within _cstCodeLogic at a DATA step level (for
example, a full DATA step or PROC SQL invocation). It creates and
populates work._cstproblems to return to the calling check macro for
reporting purposes.

Expected Macro Variables:
_cstValidationStd - Standard of the StandardLookup data set
_cstValidationStdVer - StandardVersion of the StandardLookup data set
Parameters:
_cstStdsDS - - optional - The list of supported standards to use for
        this check. If this parameter is not specified, all records in the
        glmeta.standards data set are used.
        Default: glmeta.standards
File: cstcheckutillookupvalues.sas
First available in version: 1.5

%cstgetmetadataforstandard(_cstSASReferences=, _cstResultsOverrideDS=);

[ Exposure: external ]
Retrieves standard metadata for a standard and version.

A valid SASReferences data set is passed into this macro. A row must exist for
each metadata table to retrieve. The row must identify the standard,
standardversion, type, and subtype of each metadata entity. The row SASRef and
the memname columns must specify the libname.memberName of each output data
set. Only filetype=DATASET rows are processed.

For example, to retrieve SDTM 3.1.3 reference metadata about tables into the
WORK library data set named REFTABLEMD, the SASReferences data set must
include a row with the following column values:
standard=CDISC-SDTM
standardversion=3.1.3
type=referencemetadata
subtype=table
SASRef=WORK
memname=REFTABLEMD
filetype=dataset

NOTE: The SASReferences data set must include records for only a single
registered standard and version.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
        Values 1 | 0
_cstMessages - Cross-standard work Messages data set
_cstMsgID - Results: Result ID
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstSASReferences - - required - The (libname.)member that refers to a
        valid SASReferences file.
_cstResultsOverrideDS - - optional - The (libname.)member that refers
        to the Results data set to create. If omitted, the Results data set
        that is specified by &_cstResultsDS is used.
File: cstgetmetadataforstandard.sas
First available in version: 1.6

%cstupdatestandardsasrefs(_cstSASReferences=, _cstOutputDS=);

[ Exposure: internal ]
Expands all relative paths to full paths in a SASReferences file.

By default, a StandardSASReferences data set provides file paths that are
relative to the rootpath as defined in the global standards library data sets.
Relative paths must resolve to full paths.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSASRefsLoc - SASReferences file location
_cstSASRefsName - SASReferences file name
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstSASReferences - - optional - The(libname.)member that points to a
        SASReferences file to update. If this parameter is not specified,
        specify the SASReferences file information by using the global
        macro variables _cstSASRefsLoc and _cstSASRefsName. If neither of
        these methods is used, _cstSASRefs is used.
_cstOutputDS - - required - The output data set to create that contains
        the updated information.
File: cstupdatestandardsasrefs.sas
First available in version: 1.5

%cstutil_allocatesasreferences(_cstSASRefsType=SASREFERENCES);

[ Exposure: internal ]
Allocates the librefs and filerefs in the SASReferences data set.

This macro also sets the autocall, format search, and compiled library paths
based on the SASReferences settings.

This macro must be called outside the context of a DATA step, typically as an
initial step in any SAS Clinical Standards Toolkit driver program (for example,
cst_validate).

NOTE: Multiple calls to cstutilvalidatesasreferences are made before
invoking cstutil_allocatesasreferences and within
cstutil_allocatesasreferences. These invocations validate the structure
and content of the SASReferences data set.

Expected Macro Variables:
_cstCheckID - Check ID from the run-time check metadata
_cstDeBug - Turns debugging on or off for the session
_cstFMTLibraries - Modify format search path with..
_cstLRECL - Logical record length setting for filename statement
_cstMessageOrder - Merge or append message data sets
_cstMessages - Cross-standard work messages data set
_cstReallocateSASRefs - Reallocate SAS librefs and filerefs
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSrcData - Results: Source entity being evaluated
_cst_MsgID - Results: Result or validation check ID
_cst_MsgParm1 - Messages: Parameter 1
_cst_MsgParm2 - Messages: Parameter 2
_cst_rc - Task error status
Parameters:
_cstSASRefsType - - optional - The initial type of SASReferences data set
        on which to base the set up:
        SASREFERENCES: Lookthrough to standardsasreferences for any
        incomplete path/memname records by using
        cst_insertstandardsasrefs.
        STANDARDSASREFERENCES: Resolve relative paths using
        cstupdatestandardsasrefs.
        Values: SASREFERENCES | STANDARDSASREFERENCES
        Default: SASREFERENCES
File: cstutil_allocatesasreferences.sas
First available in version: 1.2

%cstutil_allocGlobalMetadataLib(_cstLibname=);

[ Exposure: external ]
Allocates the global standards metadata library in Read-only mode.

Expected Macro Variables:
_cst_rc - Task error status
Parameters:
_cstLibname - - required - The libname to assign.
File: cstutil_allocglobalmetadatalib.sas
First available in version: 1.2

%cstutil_appendresultds(_cstErrorDS=, _cstVersion=&_cstStandardVersion, _cstSource=&_cstCheckSource, _cstStdRef=, _cstOrderBy=);

[ Exposure: internal ]
Appends a check-level Results data set to the process Results data set.

This macro appends a check-level Work Results data set to the process Work
Results data set. The parameters that are passed are check-level values, not
record-level values.

This macro must be called outside the context of a DATA step.

Expected Macro Variables:
_cstCheckID - Check ID from the run-time check metadata
_cstCheckSource - Source of check found in validation master/control
_cstDebug - Turns debugging on or off for the session
_cstMessages - Cross-standard work messages data set
_cstResultFlag - Results: Problem was detected
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSrcData - Results: Source entity being evaluated
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cst_MsgID - Results: Result or validation check ID
_cst_MsgParm1 - Messages: Parameter 1
_cst_MsgParm2 - Messages: Parameter 2
_cst_rc - Task error status
Parameters:
_cstErrorDS - - required - A SAS Work data set that contains one or more
        observations that document the results of check-level validation
        processing on a source data set record level.
_cstVersion - - required - The specific version of the model, which is
        used to lookup an associated message in the Messages data set.
        This value defaults to the value that is specified by
        _cstStandardVersion.
        Default: &_cstStandardVersion
_cstSource - - required - The source of the check, which enables source-
        specific messaging. This value is used to look up an associated
        message in the Messages data set.
        Default: &_cstCheckSource
_cstStdRef - - optional - The reference in the standard that supports
        checks.
_cstOrderBy - - optional - The column order (SQL form, comma-separated
        columns) that the _cstErrorDS must have when exiting this macro.
        The order of the records is important.
File: cstutil_appendresultds.sas
First available in version: 1.2

%cstutil_buildcollist(_cstFormatType=DATASET, _cstColWhere=, _cstDomWhere=, _cstStd=&_cstStandard, _cstStdVer=&_cstStandardVersion, _cstColDSName=&_cstColumnMetadata, _cstDomDSName=&_cstTableMetadata, _cstColSubOverride=N, _cstDomSubOverride=N);

[ Exposure: internal ]
Builds columns based on the value from validation_control.columnscope.

This macro builds a set of columns (in either list format or data set format)
based on the value from the validation check control file
validation_control.columnscope.

The expected result is that the work._csttablemetadata and
work._cstcolumnmetadata data sets are created and are in synchronization. This
means that they are consistent with regard to the tables based on resolving
the tableScope and columnScope check macro fields.

The rules used to interpret columnScope values (using mostly CDISC SDTM
examples):
- validation_control.columnscope can be null.
- Blanks are converted to "+" (for example, LBDTC LBENDTC becomes
LBDTC+LBENDTC).
- The value must not begin with "+" or "-".
- If the blank conversion results in multiple "+" characters, all but one of
these characters are removed (for example, AE1 +DM1 becomes AE1++DM1,
which becomes AE1+DM1).
- No attempt is made to assess the validity of the columnScope value (for
example, **TEST-AE1 is allowed, although no change to the resolved set of
**TEST columns occurs).
- The derived set of columns is built by parsing columnScope from left to
right (for example, ALL-**TEST builds a set of all columns removing all
**TEST columns).
- If <libref> is included, it must be listed in the SASReferences.SASRef
column.
- Wildcard conventions:
- Must use the string **
- Can appear as a suffix (for example, SUPP**, for all columns that
start with SUPP)
- Can appear as a prefix (for example, **DTC, for all columns that end
with DTC)
- Can appear alone (for example, **), which is equivalent to _ALL_
- Use <table>.** for all columns in the specified data set
- Use **.USUBJID for all USUBJID columns across referenced data sets
- Sublists are delimited by brackets, and resolved lengths (that is,
# columns) must be the same unless _cst*SubOverride is set to Y. Sublists
must conform to the non-sublist rules stated above.
- A special naming convention of <column>:<value>, such as
QUALIFIERS:DATETIME, enables you to specify to subset columns a
_cstColumnMetadata column and column value. In this example, all
_cstColumnMetadata.QUALIFIERS='DATETIME' columns are returned.

Sample columnscope values:
_ALL_ (all columns)
AESEQ (a single column)
LBDTC+LBENDTC (multiple columns)
QUALIFIERS:DATETIME (_cstColumnMetadata.QUALIFIERS='DATETIME')
**TEST (all columns ending in "TEST")
DM** (all columns beginning with "DM")
**TEST+**TESTCD (all columns ending in "TEST" or "TESTCD")
[AESTDY+CMSTDY+EXSTDY][AEENDY+CMENDY+EXENDY] (two paired sublists)
SRCDATA1.AE.AESTDY+SRCDATA2.AE.AESTDY (AESTDY column from AE data sets in
two different libraries)
AE.** (all columns in the AE table)
**.USUBJID (all USUBJID columns from all tables)

Required global macro variables (beyond reporting and debugging variables):
_cstTableMetadata
_cstColumnMetadata

Required file inputs:
work._cstcolumnmetadata

Expected Macro Variables:
_cstColumnMetadata - Table that contains column metadata referenced in
        _cstStandard
_cstColumnScope - Column scope as defined in validation check metadata
_cstDebug - Turns debugging on or off for the session
_cstMsgID - Results: Result or validation check ID
_cstMsgParm1 - Messages: Parameter 1
_cstMsgParm2 - Messages: Parameter 2
_cstResultFlag - Results: Problem was detected
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSrcData - Results: Source entity being evaluated
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cstTableMetadata - Table that contains table metadata referenced in
        _cstStandard
_cstTableScope - Table scope as defined in validation check metadata
_cst_rc - Task error status
Parameters:
_cstFormatType - - required - The format type:
        LIST: Sets macro variables of # tables and space-delimited list
        of tables.
        DATASET: Returns a data set of tables that match the tableScope
        specification.
        Values: LIST | DATASET
        Fefault: DATASET
_cstColWhere - - optional - The WHERE clause to subset the returned set
        of columns. The WHERE clause is applied as the last step.
_cstDomWhere - - optional - The WHERE clause to subset the returned set
        of tables. The WHERE clause is applied as the last step.
_cstStd - - required - The name of the registered standard. Typically
        used only with a validation that involves multiple standards.
        Default: &_cstStandard
_cstStdVer - - required - The version of _cstStd. Typically used only
        with validation that involves multiple standards.
        Default: &_cstStandardVersion
_cstColDSName - - conditional - The name of the data set with column
        metadata returned when _cstFormatType=DATASET.
        Default: &_cstColumnMetadata
_cstDomDSName - - conditional - The name of the data set with table
        metadata returned when _cstFormatType=DATASET.
        Default: &_cstTableMetadata
_cstColSubOverride - - required - Override sublist processing to allow
        sublists of different lengths (such as
        columnScope=[**DTC][RFSTDTC] ).
        Values: N | Y
        Default: N
_cstDomSubOverride - - required - Override sublist processing to allow
        sublists of different lengths (such as tableScope=[_ALL_-DM][DM] ).
        Values: N | Y
        Default: N
File: cstutil_buildcollist.sas
First available in version: 1.2

%cstutil_builddomlist(_cstFormatType=DATASET, _cstDomWhere=, _cstStd=&_cstStandard, _cstStdVer=&_cstStandardVersion, _cstDomDSName=&_cstTableMetadata, _cstSubOverride=N);

[ Exposure: internal ]
Builds a tables based on the value from validation_control.tablescope.

This macro builds a set of tables (in either list format or data set format)
based on the value from the validation check control file
validation_control.tablescope.

These are the rules used to interpret tableScope values (using mostly CDISC
SDTM examples):
- validation_control.tablescope cannot be null.
- Blanks are converted to "+" (for example, AE DM becomes AE+DM).
- The value must not begin with '+' or '-'.
- If the blank conversion results in multiple '+' characters, all but one
of the '+' characters are removed (for example, AE +DM becomes AE++DM,
which becomes AE+DM).
- No attempt is made to assess the validity of the tableScope value (for
example, CLASS:FINDINGS-AE is allowed, although no change to the resolved
set of CLASS:FINDINGS tables occurs).
- The derived set of tables is built by parsing tableScope from left to
right (for example, _ALL_-CLASS:RELATES builds a set of all tables
removing RELREC and SUPP**).
- If <libref> is included, it must be listed in the
SASReferences.SASRef column.
- Wildcard conventions:
- must use the string **
- can appear as a suffix (for example, SUPP** for all tables that start
with SUPP)
- can appear as a prefix (for example, **DM for all tables that end
with DM)
- can appear alone (for example, **), equivalent to _ALL_
- <libref>.** for all tables in the specified library
- **.AE for all AE tables across referenced libraries
- Sublists are delimited by brackets, and resolved lengths (that is, #
columns) must be the same unless _cst*SubOverride is set to Y, and they
must conform to non-sublist rules stated above.
- A special naming convention of <column>:<value>, such as CLASS:EVENTS,
allows you to specify a _cstTableMetadata column and column value to
subset tables. In this example, all CLASS='EVENTS' tables are returned.

Sample tablescope values:
_ALL_ (all tables)
AE (a single table)
DM+DS (multiple tables)
CLASS:EVENTS (_cstTableMetadata.CLASS='EVENTS')
SUPP** (all Supplemental Qualifier tables)
_ALL_-SUPP** (all tables except Supplemental Qualifier tables)
[DM][EX] (two sublists comparing DM with EX)
SRCDATA1.AE+SRCDATA2.AE (AE table from two different libraries)
SRCDATA.** (all tables from the SRCDATA library)
**.AE (all AE tables from all sourcedata libraries)

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMsgID - Results: Result or validation check ID
_cstMsgParm1 - Messages: Parameter 1
_cstMsgParm2 - Messages: Parameter 2
_cstResultFlag - Results: Problem was detected
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSrcData - Results: Source entity being evaluated
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cstTableMetadata - Table that contains table metadata referenced in
        _cstStandard
_cstTableScope - Table scope as defined in validation check metadata
_cst_rc - Task error status
Parameters:
_cstFormatType - - required - The format type:
        LIST: Sets macro variables of # tables and space-delimited list
        of tables.
        DATASET: Returns a data set of tables matching tableScope
        specification.
        Values: LIST | DATASET
        Default: DATASET
_cstDomWhere - - optional - The WHERE clause to subset returned set of
        tables. A WHERE clause is applied as the last step.
        Any WHERE clause is applied as the last step.
_cstStd - - required - The name of the registered standard. Typically used
        only with a validation that involves multiple standards.
        Default: &_cstStandard
_cstStdVer - - required - The version of _cstStd. Typically used only with
        validation involving multiple standards.
        Default: &_cstStandardVersion
_cstDomDSName - - conditional - The name of the data set that is returned
        when _cstFormatType=DATASET.
        Default: &_cstTableMetadata
_cstSubOverride - -required - Override sublist processing to allow
        sublists of different lengths (such as tableScope=[_ALL_-DM][DM] ).
        Values: N | Y
        Default: N
File: cstutil_builddomlist.sas
First available in version: 1.2

%cstutil_buildformatsfromxml(_cstFmtLib=, _cstReplaceFmtCat=Y, _cstFmtCatPrefix=, _cstFmtCatLang=, _cstFmtCatLangOption=English);

[ Exposure: external ]
Creates format catalogs from codelist information in XML-based standards.

This macro reads codelist information from CDISC XML-based standards to create
one or more SAS format catalogs, based on the xml:lang language tags.

This macro is for use with CDISC XML-based standards such as CRT-DDS and ODM.
Those standards capture acceptable values in codelists.

This macro is called by the odm_read and crtdds_read macros.

Assumptions:
- If EnumeratedItems are encountered, these items are added to each
language-specific format catalog that is created.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSrcData - Results: Source entity being evaluated
_cstSrcDataLibrary - Source library being evaluated
_cstStdMnemonic - Standard mnemonic provided by the SAS Clinical
        Standards Toolkit
_cst_rc - Task error status
Parameters:
_cstFmtLib - - optional - The location where catalogs are written. If
        this parameter is not specified, the default value is first derived
        from SASReferences, then WORK.
_cstReplaceFmtCat - - optional - Replace an existing format catalog by
        the same name in _cstFmtLib.
        Default behavior: Y (overwrite existing catalog)
        Values: N | Y
        Default: Y
_cstFmtCatPrefix - - optional - The prefix to use for catalog names. If
        this parameter is not specified, the default value is
        <standard mnemonic>FmtCat (such as ODMFmtCat). This default
        produces an English format catalog name of ODMFmtCat_en.
_cstFmtCatLang - - optional - Create a format catalog only for the
        specified language. Example: _cstFmtCatLang=en. If no records exist
        for the specified language, an empty catalog is created.
_cstFmtCatLangOption - - optional - The action to take when no language
        tag is provided in the XML:
        Ignore: Records are ignored (but they are reported in
        the SAS log).
        English: Records are added to the English catalog.
        Use_cstFmtCatLang: Records are added to the language catalog that is
        specified by _cstFmtCatLang.
        Values: Ignore | English |Use_cstFmtCatLang
        Default: English
File: cstutil_buildformatsfromxml.sas
First available in version: 1.4

%cstutil_checkds(_cstdsname=, _csttype=, _cstsubtype=, _cststandard=*, _cststandardversion=*);

[ Exposure: internal ]
Validates a data set structure against a template data set structure.

This macro validates the structure of a data set against the structure of the
template data set that is provided with a standard.

Expected Macro Variables:
_cstGRoot - Root path of the global standards library
_cstMessages - Cross-standard work messages data set
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstdsname - - required - The two-level name of the data set to validate.
_csttype - - required - The type of data set to create. This value comes
        from the TYPE column in the SASReferences file for the
        standard-version combination.
_cstsubtype - - optional - This value comes from the SUBTYPE column in
        the SASReferences file for the standard-version combination. If the
        type has no subtypes, this value can be omitted. Otherwise, it must
        be specified.
_cststandard - - optional - The name of the data standard to validate
        against. By default, all standards are included.
_cststandardversion - - optional - The version of the data standard to
        validate against. By default, all standardVersions are included.
File: cstutil_checkds.sas
First available in version: 1.2

%cstutil_cleanupcstsession(_cstClearCompiledMacros=0, _cstClearLibRefs=0, _cstResetSASAutos=0, _cstResetCmpLib=0, _cstResetFmtSearch=0, _cstResetSASOptions=1, _cstDeleteFiles=1, _cstDeleteGlobalMacroVars=0, _cstStd=, _cstStdVer=);

[ Exposure: internal ]
Cleans up after a SAS Clinical Standards Toolkit session.

The cleanup includes removing any process-level SAS files and clearing the
work.sasmacr catalog.

This macro is most often used at the end of a SAS Clinical Standards Toolkit
driver program, such as validate_data. This macro should be called where a
DATA step or PROC is allowed.

Expected Macro Variables:
_cstDeBug - Turns debugging on or off for the session
_cstInitSASAutos - Initial SASautos setting
_cstMessages - Cross-standard work messages data set
_cstMetricsDS - Data set used to accumulate metrics for a validation
        process
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
Parameters:
_cstClearCompiledMacros - - optional - Remove all compiled macros from
        the work.sasmacr catalog. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 0
_cstClearLibRefs - - optional - Deallocate all librefs and filerefs that
        were set, based on the SASReferences content. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 0
_cstResetSASAutos - - optional - Reset the autocall search path to its
        initial state. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 0
_cstResetCmpLib - - optional - Reset the compiled library path to its
        initial state. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 0
_cstResetFmtSearch - - optional - Reset the format search path to its
        initial state. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 0
_cstResetSASOptions - - optional - Reset the SAS options to their initial
        states. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 1
_cstDeleteFiles - - optional - Delete all SAS Clinical Standards Toolkit
        work files and catalogs. 0=No, 1=Yes.
        NOTE: If _cstDebug=1, files are NOT deleted, even when
        _cstDeleteFiles=1.
        Values: 0 | 1
        Default: 1
_cstDeleteGlobalMacroVars - - optional - Delete all SAS Clinical Standards
        Toolkit global macro variables that were set, based on the property
        filename/value pairs. 0=No, 1=Yes.
        Values: 0 | 1
        Default: 0
_cstStd - - optional - Limit cleanup to records for this standard (in
        combination with _cstStdVer)
_cstStdVer - - optional - Limit cleanup to records for this
        standardversion (in combination with _cstStd)
File: cstutil_cleanupcstsession.sas
First available in version: 1.2

%cstutil_CreateMetadataReport(_cstStandardTitle=, _cstValidationDS=, _cstValidationDSWhClause=, _cstMessagesDS=, _cstStdRefDS=, _cstReportOutput=, _cstCheckMDReport=N, _cstMessageReport=N, _cstStdRefReport=N, _cstRecordView=N);

[ Exposure: external ]
Creates a report that documents the metadata of a process.

The report for the SAS Clinical Standards Toolkit process is based on these
data sets:
validation_master
validation_control
Messages
validation_stdRef

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
Parameters:
_cstStandardTitle - - optional - The title that defines the title2
        statement for all reports.
_cstValidationDS - - required - The validation data set that is used by a
        SAS Clinical Standards Toolkit process. This is
        validation_master or validation_control, or a derivative specified
        by you.
_cstValidationDSWhClause - - optional - The WHERE clause that is applied
        to _cstValidationDS.
_cstMessagesDS - - required - The Messages data set that is used by a
        SAS Clinical Standards Toolkit process.
_cstStdRefDS - - conditional - The Validation_stdref data set that is
        created for a SAS Clinical Standards Toolkit standard. If
        _cstStdRefReport=Y, this file is required.
_cstReportOutput - - required - The file that contains the report.
        The acceptable files are PDF, RTF, CSV, and HTML. The extension is
        used to determine SAS ODS Graphics Editor output.
_cstCheckMDReport - - optional - Generate the Run panel 2, Check Details.
        Values: Y | N
        Default: N
_cstMessageReport - - optional - Generate the Run panel 3, Message
        Details.
        Values: Y | N
        Default: N
_cstStdRefReport - - optional - Generate the Run panel 4, Reference
        Information.
        Values: Y | N
        Default: N
_cstRecordView - - optional - Generate a full listing of all available
        check metadata, by check, in a single listing. Either this listing
        or the multi-panel report can be generated in a single invocation
        of this macro, but not both.
        Values: Y | N
        Default: N
File: cstutil_createmetadatareport.sas
First available in version: 1.3

%cstutil_createreport(_cstSASReferencesDSet=, _cstResultsDSet=&_cstRptResultsDS, _cstMetricsDSet=&_cstRptMetricsDS, _cstReportErrorsOnly=N, _cstReportObs=, _cstReportByTable=N, _cstTableChecksDSet=, _cstTableChecksCode=, _cstKeepTableCheckList=N, _cstTableSubset=, _cstReportOutput=, _cstSummaryReport=Y, _cstIOReport=Y, _cstMetricsReport=Y, _cstGeneralResultsReport=Y, _cstCheckIDResultsReport=Y);

[ Exposure: external ]
Creates a report that documents the data sets generated by a process.

The report for the SAS Clinical Standards Toolkit process is based on the
Results and Metrics data sets that are generated by the process.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstError - Returned error code
_cstRptMetricsDS - Report metrics data set created by a SAS Clinical
        Standards Toolkit process
_cstRptResultsDS - Report results data set created by a SAS Clinical
        Standards Toolkit process
_cstUniqueTables - List of unique reporting tables
_cstUniqueTablesCnt - Count of unique reporting tables
_cst_rc - Task error status
Parameters:
_cstSASReferencesDSet - - conditional - The SASReferences data set that is
        used by a SAS Clinical Standards Toolkit process. Either this data
        set or the _cstresultsdset must exist.
_cstResultsDSet - - conditional - The Results data set that is created by
        a SAS Clinical Standards Toolkit process. Either this data set or
        the _cstsasreferencesdset must exist.
        Default: &_cstRptResultsDS
_cstMetricsDSet - - optional - The Metrics data set that is created by a
        SAS Clinical Standards Toolkit process.
        Default: &_cstRptMetricsDS
_cstReportErrorsOnly - - optional - Print only non-informational Results
        data set records.
        NOTE: Any value that is not equal to N is assumed to be Y.
        Values: Y | N
        Default: Y
_cstReportObs - - optional - The number of Results data set records (per
        checkid) to print. If blank, all records are printed.
_cstReportByTable - - optional - Generate Report1 (by checkid) results or
        Report2 (by table) results.
        N: Generate Report1.
        Y: Generate Report2.
        NOTE: Any value that is not equal to Y is assumed to be N.
        Values: Y | N
        Default: N
_cstTableChecksDSet - - optional - The data set that specifies a list of
        tables for each check. Use of this parameter assumes that this data
        set has been built before running this report. If this data set does
        not exist, it is created.
_cstTableChecksCode - - conditional - The macro to build
        _cstTableChecksDSet, if it does not exist or is not passed as a
        parameter. Required only if _cstReportByTable=Y and
        _cstTableChecksDSet is not specified.
_cstKeepTableCheckList - - required - For Report2, keep the derived
        list of tables (_csttablechecklist) to reuse in subsequent report
        requests. Building this file might take awhile.
        NOTE: Any value that is not equal to Y is assumed to be N.
        Values: Y | N
        Default: N
_cstTableSubset - - optional - For Report 2, subset Results data set to
        the specified source data set. If blank or _ALL_, all records are
        printed. Example: DM.
_cstReportOutput - - required - The path and filename in which to write
        the report output.
        Values: Y | N
        Default: Y
_cstSummaryReport - - optional - Generate the Report Summary panel.
        NOTE: Any value that is not equal to N is assumed to be Y.
        Values: Y | N
        Default: Y
_cstIOReport - - optional - Generate the Process Inputs/Outputs panel.
        NOTE: Any value that is not equal to N is assumed to be Y.
        Values: Y | N
        Default: Y
_cstMetricsReport - - optional - Generate the Process Metrics panel.
        NOTE: Any value that is not equal to N is assumed to be Y.
        Values: Y | N
        Default: Y
_cstGeneralResultsReport - - optional - Generate the General Process
        Reporting panel.
        NOTE: Any value that is not equal to N is assumed to be Y.
        Values: Y | N
        Default: Y
_cstCheckIDResultsReport - - optional - Generate the Process Results
        panel.
        NOTE: Any value that is not equal to N is assumed to be Y.
        Values: Y | N
        Default: Y
File: cstutil_createreport.sas
First available in version: 1.3

%cstutil_createsubdir(_cstSubDir=);

[ Exposure: internal ]
Creates a subdirectory on a computer that is not running Microsoft Windows.

The SAS Clinical Standards Toolkit sample drivers create output files that
need to have Read and Write access to the subdirectories. This macro creates
the subdirectories in the specified workspace. If a value is missing, the
StudyOutputPath points to the Work directory, and any subdirectories are
created under it. StudyOutputPath is referenced in SASReferences.

Expected Macro Variables:
studyOutputPath - Toolkit output path for a study
Parameters:
_cstSubDir - - optional - The subdirectory to create. If this parameter
        is not specified, the macro assumes no subdirectory is needed.
File: cstutil_createsubdir.sas
First available in version: 1.4

%cstutil_createsublists(_cstSupplementalVar=);

[ Exposure: internal ]
Creates work._cstsublists that has interpreted validation check metadata.

This macro creates the work._cstsublists data set that has interpreted
validation check metadata as specified in the columnScope column in the
expected form of [var1][var2].

This macro is called directly only as a validation check metadata codelogic
value. This macro is NOT always called for the derivation of work._cstsublists.

Required file inputs:
work._cstcolumnmetadata
work._csttablemetadata

Expected Macro Variables:
_cstColumnScope - Column scope as defined in validation check metadata
_cstSeqCnt - Results: Sequence number within _cstResultSeq
Parameters:
_cstSupplementalVar - - optional - Specifies an additional variable
        that must be present for the derived work._cstsublists to be
        valid. If the additional variable is NOT present, the records for
        the specific data set are deleted from work._cstsublists.
File: cstutil_createsublists.sas
First available in version: 1.4

%cstutil_createTempMessages(_cstCreationFlag=);

[ Exposure: internal ]
Creates a temporary Messages data set using the CST-FRAMEWORK messages.

If the Messages data set specified by the macro variable &_cstMessages does
not exist, this macro creates a temporary version. It looks for the default
version of the SAS Clinical Standards Toolkit framework. It copies the Messages
data set specified in the default SASReferences file to the name specified in
the &_cstMessages macro variable. If the caller supplies the name of a macro
variable in _cstCreationFlag, this is set if the data set was created in this
macro.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
Parameters:
_cstCreationFlag - - optional - The name of the macro variable to set in
        the macro. If the macro does not create the Messages data set
        (because it existed), the macro variable is set to 0. If the macro
        creates the data set, the macro variable is set to 1. It is strongly
        suggested that the caller use this macro variable to ensure that the
        temporary data set is cleaned up afterward.
File: cstutil_createtempmessages.sas
First available in version: 1.2

%cstutil_deleteDataSet(_cstDataSetName=, _cstLogging=0, _cstLoggingDS=);

[ Exposure: internal ]
Deletes a data set, if it exists.

Clinical Standards Toolkit utility macro designed to delete a data set. The
macro optionally logs the event in the global library transaction log.

          
History:
   2013-10-09
Added logging parameters (1.6)
Parameters:
_cstDataSetName - - required - The (libname.)memname of the data set to
        delete.
_cstLogging - - optional - Boolean to signal whether deletion of the
        data set should be logged in the global library transaction log.
        Values: 0 (No) | 1 (Yes)
        Default: 0
_cstLoggingDS - - optional - User-defined data set to be used to log
        data set deletions. Ignored if _cstLogging=0. If _cstLogging=1,
        and _cstLoggingDS is not provided, the default data set used is
        derived from the CST_LOGGING_PATH and CST_LOGGING_DS static
        variables. If provided, must follow <libref.dset> convention.
File: cstutil_deletedataset.sas
First available in version: 1.2

%cstutil_getcstversion;

[ Exposure: external ]
Returns the SAS Clinical Standards Toolkit product version.

The return value can be a product version, such as 1.2 or 1.4, or null. A null
value indicates that an error occurred while retrieving the version number.
(The log file contains more information.)

Use: %put CST version: %cstutil_getcstversion

File: cstutil_getcstversion.sas
First available in version: 1.5

%cstutil_getRandomNumber(_cstVarname=);

[ Exposure: internal ]
Returns a four-digit random number that can be used in work data set names.

Parameters:
_cstVarname - - required - The name of the macro variable to set with
        the four-digit number.
File: cstutil_getrandomnumber.sas
First available in version: 1.2

%cstutil_getsasreference(_cstStandard=, _cstStandardVersion=, _cstSASRefType=, _cstSASRefSubtype=, _cstSASRefsasref=, _cstSASRefmember=, _cstConcatenate=0, _cstFullname=0, _cstAllowZeroObs=0);

[ Exposure: external ]
Gets row-level metadata from SASReferences, given the type and subtype.

The SASReferences data set contains references to each library, SAS file, and
non-SAS file that is required to perform some SAS Clinical Standards Toolkit
function. This macro gets the SAS libref (and, optionally, member name) or the
fileref for a specific SASReferences record, given the type and, optionally,
the subtype.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
        Required file inputs:
        sasreferences data set (as defined by &_cstSASRefs)
Parameters:
_cstStandard - - optional - The name of a registered standard. If blank,
        no subsetting by standard is attempted.
_cstStandardVersion - - optional - The version of the registered standard.
        If blank, no subsetting by version is attempted.
_cstSASRefType - - required - The file or data type from
        sasreferences.type.
        Values (representative): autocall | control | sourcedata
_cstSASRefSubtype - - optional - The file or data subtype from
        sasreferences.subtype. Values are specific to the type. Some types
        do not have subtypes.
        Values (representative): column | lookup | table | validation
_cstSASRefsasref - - conditional - The name of the calling macro variable
        to populate with the value of sasreferences.sasref. Either (or both)
        _cstSASRefsasref or _cstSASRefmember must be non-null.
_cstSASRefmember - -conditional - The name of the calling macro variable
        to populate with the value of sasreferences.memname, based on the
        value of _cstFullname. Either (or both) _cstSASRefsasref or
        _cstSASRefmember must be non-null.
_cstConcatenate - - optional - Return multiple row values, space-
        delimited, for each macro variable requested (sasref and member).
        1: Return multiple row values.
        0: Return a single value. Do not concatenate.
        Values: 0 | 1
        Default: 0
_cstFullname - - optional - Return the full name from
        sasreferences.memname.
        1: Return the full name.
        0: Return the file name without the suffix.
        Values: 0 | 1
        Default: 0
_cstAllowZeroObs - - optional - Allow SASReferences to operate without
        Warnings, when a row that is requested is not found and, therefore,
        returns zero observations. 0 = no, 1 = yes.
        Values: 0 | 1
        Default: 0
File: cstutil_getsasreference.sas
First available in version: 1.2

%cstutil_getsubjectcount(_cstDS=, _cstSubID=&_cstSubjectColumns);

[ Exposure: internal ]
Populates _cstMetricsCntNumSubj with the count of the number of subjects.

This macro populates the metrics global macro variable _cstMetricsCntNumSubj
with the count of the number of subjects. This is a part of metrics processing.

Expected Macro Variables:
_cstMetricsCntNumSubj - Validation metrics: number of subjects evaluated
_cstSubjectColumns - Standard-specific set of columns that identify a
        subject
Parameters:
_cstDS - - required - The source data set that contains the subject data
        of interest.
_cstSubID - - optional - The set of subject identifiers appropriate for
        the _cstDS data set.
        Default: &_cstSubjectColumns (global macro variable)
File: cstutil_getsubjectcount.sas
First available in version: 1.2

%cstutil_internalmanageresults(_cstAction=);

[ Exposure: internal ]
Saves and restores process results macro variables.

This macro is usually used outside of the normal SAS Clinical Standards Toolkit
process flow. (This means that cst_setStandardProperties() or
cstutil_processsetup() has not been called.)

This macro is typically called twice in a calling module. The first call saves
global results macro variable values, and the second call restores them to
their prior state.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstResultsOverrideDS - Name of override Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstAction - - required - The primary action to perform. If this parameter
        is blank, no subsetting by standard is attempted.
        Values: SAVE | RESTORE
File: cstutil_internalmanageresults.sas
First available in version: 1.2

%cstutil_messagesdsattr;

[ Exposure: internal ]
Defines the column attributes of the Messages data set.

Use this macro in a statement level in a SAS DATA step, where a SAS ATTRIB
statement might be used.

File: cstutil_messagesdsattr.sas
First available in version: 1.2

%cstutil_metricsdsattr;

[ Exposure: internal ]
Defines the column attributes of the Metrics data set.

Use this macro in a statement level in a SAS DATA step, where a SAS ATTRIB
statement might be used.

File: cstutil_metricsdsattr.sas
First available in version: 1.2

%cstutil_parsecolumnscope(_cstScopeStr=, _cstOpSource=, _cstSublistNum=);

[ Exposure: internal ]
Parses _cstColumnScope to add or remove columns from _cstColumnMetadata.

_cstColumnMetadata is a data set in Work. This macro is called only by the
cstutil_buildcollist() macro.

Required file inputs (created in calling cstutil_buildcollist macro):
work._csttempcolumnmetadata
work._cstcolumnmetadata

Expected Macro Variables:
_cstCheckID - Check ID from the run-time check metadata
_cstColumnScope - Column scope as defined in validation check metadata
_cstDebug - Turns debugging on or off for the session
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstScopeStr - - required - The string value to parse. Typically, this is
        the entire columnScope value (if there are no sublists), or a
        specific sublist.
_cstOpSource - - required - A modified string value to populate
        _cstRefValue.
_cstSublistNum - - required - The sublist number in columnScope. If there
        is no sublist, this is set to 1.
File: cstutil_parsecolumnscope.sas
First available in version: 1.2

%cstutil_parsescopesegment(_cstPart=, _cstVarName=, _cstMessageID=CST0004, _cstLengthOverride=N);

[ Exposure: internal ]
Parses validation check metadata columns to handle extended values.

This macro parses validation check metadata columns tableScope and columnScope
to handle extended values, such as <libref>.<table>.<column>. It also handles
wildcarding to build a logical SAS code string to subset _cstTableMetadata and
_cstColumnMetadata. This macro is currently called only by the
cstutil_parsecolumnscope() and cstutil_parsetablescope() macros.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstParseLengthOverride - Validation: Override requirement limiting
        *scope segment length
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstTString - Constructed string to subset column and table metadata
Parameters:
_cstPart - - required - The part of the tableScope or columnScope string
        to interpret. The expected value is either the SAS libref, the
        table name, or the column name, often passed as a macro variable.
        NOTE: tableScope and columnScope often include wildcard characters.
_cstVarName - - required - The column name in either _csttablemetadata or
        _cstcolumnmetadata. Typical values: sasref, a table, or column.
_cstMessageID - - optional - The SAS Clinical Standards Toolkit message ID
        to report a string that cannot be interpretted (such as a bad SAS
        name or a wildcard in the middle of the string).
        Default: CST0004
_cstLengthOverride - - optional - Ignore the length of the _cstVarName
        when building the WHERE clause against the work._csttablemetadata
        data set. (This parameter is used only by cstutil_parsetablescope).
        This enables the interpretation of a tableScope value such as
        **DATA to mean ANY table ending in DATA, regardless of the length
        of the table name.
        Values: Y | N
        Default: N
File: cstutil_parsescopesegment.sas
First available in version: 1.2

%cstutil_parsetablescope(_cstScopeStr=, _cstOpSource=, _cstSublistNum=);

[ Exposure: internal ]
Parses _cstTableScope to add or remove columns from _ cstTableMetadata.

_cstTableMetadata is a data set in Work. This macro is called only by
cstutil_builddomlist.

Required file inputs (created in calling cstutil_builddomlist macro):
work._csttablemetadata
work._csttemptablemetadata

Expected Macro Variables:
_cstCheckID - Check ID from the run-time check metadata
_cstDebug - Turns debugging on or off for the session
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstTableScope - Table scope as defined in validation check metadata
_cst_rc - Task error status
Parameters:
_cstScopeStr - - required - The string value to parse. Typically,
        this is the entire tableScope value (if there are no sublists), or
        a specific sublist.
_cstOpSource - - required - A modified string value to populate
        _cstRefValue.
_cstSublistNum - - required - The sublist number within tableScope. If
        there is no sublist, this is set to 1.
File: cstutil_parsetablescope.sas
First available in version: 1.2

%cstutil_processsetup(_cstSASReferencesSource=SASREFERENCES, _cstSASReferencesName=sasreferences, _cstSASReferencesLocation=);

[ Exposure: external ]
Sets up model-specific study metadata.

This macro sets up model-specific study metadata when using the various SAS
Clinical Standards Toolkit driver programs (for example, validate_data,
cst_reports, and so on).

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSASRefsLoc - SASReferences file location
_cstSASRefsName - SASReferences file name
_cstSetupSrc - Setup source type (RESULTS or SASREFERENCES)
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardPath - Rootpath associated with any given standard and
        standardversion
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cst_rc - Task error status
Parameters:
_cstSASReferencesSource - - optional - The initial source on which to base
        the set up. If the value is RESULTS:
        1. No other parameters are required, and setup responsibility is
        passed to the cstutil_reportsetup macro.
        2. The results data set name must be passed to
        cstutil_reportsetup as libref.memname.
        Values: SASREFERENCES | RESULTS
        Default: SASREFERENCES
_cstSASReferencesName - - optional - The name of the SASReferences data
        set.
        Default: sasreferences
_cstSASReferencesLocation - - optional - The path (folder location) of
        the SASReferences data set. If this parameter is not specified, the
        path to the WORK library is used.
File: cstutil_processsetup.sas
First available in version: 1.2

%cstutil_readcontrol;

[ Exposure: external ]
Reads a single validation_control record and creates macro variables.

This macro reads a single validation_control record, as passed in through the
data set referenced by the _cstThisCheckDS global macro variable, and creates
local macro variables for each column in the control file. These macro
variables are available in the context of each specific check macro.

This macro is called by each check macro.

Expected Macro Variables:
_cstCheckID - Check ID from the run-time check metadata
_cstDebug - Turns debugging on or off for the session
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstThisCheckDS - Metadata for a specific validation check
File: cstutil_readcontrol.sas
First available in version: 1.2

%cstutil_readxmltags(_cstXMLFilename=inxml, _cstXMLReporting=Results, _cstXMLElementDS=work.cstodmelements, _cstXMLAttrDS=work.cstodmattributes);

[ Exposure: external ]
Creates data sets of element and attribute names from an XML file.

This macro is a proof of concept. This macro reads the element tags and
attributes of an XML file. It then identifies the tags and elements that the
SAS Clinical Standards Toolkit does not currently handle using the CDISC ODM
odm_read macro.

This macro relies on a defined set of XSLT modules, metadata that specifies a
SAS representation of ODM, and a SAS XML map file that reads a derived cubexml
file. Each of these makes assumptions about the XML content to read.

Assumptions:
1. The XML file has been defined with a SAS fileref.
2. ODM reference metadata is available as defined in SASReferences.

Limitations:
1. The code does not work on a continuous-stream (no line returns)
XML file.
2. The code might not work well on multi-element rows such as
<Study><MetaDataVersion OID=..><...>. (Untested)
3. The code might not handle PCDATA... (Untested)

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstLRECL - Logical record length setting for filename statement
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardVersion - Version of the standard referenced in _cstStandard
Parameters:
_cstXMLFilename - - required - The fileref for input XML file.
_cstXMLReporting - - required - The method to report the results:
        Dataset: The following two parameters are referenced.
        Results: The differences that are detected are reported in the
        process Results data set (as defined by &_cstResultsDS).
        Values: Dataset | Results
        Default: Results
_cstXMLElementDS - - conditional - The libref.dataset for file elements.
        Used only if _cstXMLReporting=Dataset.
        Default: work.cstodmelements
_cstXMLAttrDS - - conditional - The libref.dataset for file attributes.
        Used only if _cstXMLReporting=Dataset.
        Default: work.cstodmattributes
File: cstutil_readxmltags.sas
First available in version: 1.4

%cstutil_reportgeneralprocess;

[ Exposure: external ]
Generates the General Process Reporting panel.

This macro generates the General Process Reporting panel when running the
sample driver cst_report.sas. This driver renders a SAS Clinical Standards
Toolkit process Results data set (and, optionally, the Metrics data set) in a
report-friendly format, such as PDF.

This macro is called only by cstutil_createreport.

Expected Macro Variables:
_cstResultsDset - The results data set created by a SAS Clinical
        Standards Toolit process
File: cstutil_reportgeneralprocess.sas
First available in version: 1.2

%cstutil_reportinputsoutputs;

[ Exposure: external ]
Generates the Process Inputs/Outputs panel.

This macro generates the Process Inputs/Outputs panel when running the
sample driver cst_report.sas. This driver renders a SAS Clinical Standards
Toolkit process Results data set (and, optionally, the Metrics data set) in a
report-friendly format, such as PDF.

This macro is called only by cstutil_createreport.

Expected Macro Variables:
_cstSASRefs - Run-time SASReferences data set derived in process setup
File: cstutil_reportinputsoutputs.sas
First available in version: 1.2

%cstutil_reportprocessmetrics;

[ Exposure: external ]
Generates the Process Metrics panel.

This macro generates the Process Metrics panel when running the sample driver
cst_report.sas. This driver renders a SAS Clinical Standards Toolkit process
Results data set (and, optionally, the Metrics data set) in a report-friendly
format, such as PDF.

This macro is called only by cstutil_createreport.

Expected Macro Variables:
_cstMetricsDset - Data set used to accumulate metrics for a validation
        process
_cstReportByTable - Report results by table/domain (Y), rather than by
        CheckID (N)
_cstRptResultsDS - Results data set created by a SAS Clinical Standards
        Toolkit process
File: cstutil_reportprocessmetrics.sas
First available in version: 1.2

%cstutil_reportprocessresults;

[ Exposure: external ]
Generates the Process Results panel.

This macro generates the Process Results panel when running the sample driver
cst_report.sas. This driver renders a SAS Clinical Standards Toolkit process
Results data set (and, optionally, the Metrics data set) in a report-friendly
format, such as PDF.

This macro is called only by cstutil_createreport.

          
History:
   2013-07-16
Removed hard-coded font reference for reports. User default
font is now used for reports. This might cause format problems
with the data fitting into the cells properly.
Expected Macro Variables:
_cstDate - Date the processs was run
_cstMessages - Cross-standard work Messages data set
_cstReportByTable - Report results by table and domain (Y), rather than
        by CheckID (N)
_cstReportErrorsOnly - Print only non-informational Result data set
        records
_cstReportObs - Number of Result data set records (per checkid) to print
_cstReportRuntime - Datetime of the report
_cstResultsDset - Results data set created by a SAS Clinical Standards
        Toolkit process
_cstRptControl - Run-time validation control (check) data set
_cstTableChecksCode - Macro that builds _cstTableChecksDset
_cstTableChecksDset - Data set that provides the list of tables for each
        check
_cstTableSubset - Subset Results data set by source data set (for
        example, DM)
_cstTypeType - of process (for example, VALIDATION)
_cstValDSType - Validation check file as a data set or a data view
File: cstutil_reportprocessresults.sas
First available in version: 1.2

%cstutil_reportprocesssummary;

[ Exposure: external ]
Generates the Process Summary panel.

This macro generates the Process Summary panel when running the sample driver
cst_report.sas. This driver renders a SAS Clinical Standards Toolkit process
Results data set (and, optionally, the Metrics data set) in a report-friendly
format, such as PDF.

This macro is called only by cstutil_createreport.

Expected Macro Variables:
_cstDate - Date the processs was run
_cstKeepTableChecklist - Keep the derived list of tables
        (_csttablechecklist) to reuse in subsequent report requests
_cstMetricsDset - Data set used to accumulate metrics for a validation
        process
_cstMetricsReport - Generate Process Metrics panel (Y/N)
_cstReportByTable - Report results by table/domain (Y), rather than by
        CheckID (N)
_cstReportErrorsOnly - Print only non-informational result data set
        records
_cstReportObs - Number of result data set records (per checkid) to print
_cstReportOutput - Path/filename where report output is written
_cstResultsDset - Results data set created by a SAS Clinical Standards
        Toolkit process
_cstRptResultsDS - The results data set created by a SAS Clinical
        Standards Toolkit process
_cstSASReferencesDset - SASReferences data set used by a process
_cstTableChecksCode - Macro to build _cstTableChecksDset
_cstTableChecksDset - Data set providing a list of tables for each check
_cstTableSubset - Subset Results data set by source data set (for
        example, DM)
File: cstutil_reportprocesssummary.sas
First available in version: 1.2

%cstutil_reportsetup(_cstRptType=Metadata);

[ Exposure: external ]
Sets up process and metadata reporting.

This macro is run before generating several sample cross-standard SAS Clinical
Standards Toolkit reports.

If _cstSetupSrc=RESULTS, the code interprets the information in a Results data
set that is referenced by _cstRptResultsDS. Otherwise, the code interprets
the information in the SASReferences data set that is referenced by
_cstSASRefs.

This macro is called by the drivers cst_report.sas and cst_metadatareport.sas.

Expected Macro Variables:
_cstMessages - Cross-standard work messages data set
_cstMetricsDS - Metrics data set
_cstResultsDS - Results data set
_cstRptControl - Run-time validation control (check) data set
_cstRptLib - SAS library destination for report output file
_cstRptMetricsDS - Metrics data set created by a SAS Clinical Standards
        Toolkit process
_cstRptOutputFile - Path and name of report output file
_cstRptResultsDS - Results data set created by a SAS Clinical Standards
        Toolkit process
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSASRefsLoc - SASReferences file location
_cstSASRefsName - SASReferences file name
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSetupSrc - Initial source on which to base the setup. In this
        context, usually set based on the value of the
        _cstSASReferencesSource macro variable.
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cstStdRef - Data set (libref.dataset) that specifies supplemental
        reference metadata
_cstStdTitle - Main derived standard-specific title of report
_cstValDSType - Validation check file as a DATA set or VIEW
_cst_rc - Task error status
workpath - Path to the SAS session work library
Parameters:
_cstRptType - - optional- The type of report to generate:
        Metadata: Report on the validation check metadata.
        Results: Report on the process results and metrics.
        Values: Metadata | Results
        Default: Metadata
File: cstutil_reportsetup.sas
First available in version: 1.3

%cstutil_reporttabledata;

[ Exposure: external ]
Supports table (domain) reporting by expanding process results.

This macro creates work._cstrptresultsdom, which represents work._cstrptresults
that is expanded to include records for each table applicable to the original
reported result.

Assumptions:
1. Applicable only to Report2 and CDISC standards that report table-level
results (for example, CDISC SDTM and CDISC ADAM).
2. Includes a call to a CDISC SDTM- (or ADaM-) specific macro that is known
or found only in the standard-specific autocall path.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstRptControl - Run-time validation control (check) data set
_cstRptResultsDS - Results data set created by a SAS Clinical Standards
        Toolkit process
_cstSrcMetadataDS - Source table metadata
_cstTableChecksCode - Macro to build _cstTableChecksDset
_cstTableChecksDset - Data set that specifies a list of tables for each
        check
_cstTableSubset - Subset Results data set by source data set (for
        example, DM)
_cstUniqueTables - List of unique tables for which results were found
        in the Results data set. The list is space-delimited.
_cstUniqueTablesCnt - Count of tables in _cstUniqueTables
File: cstutil_reporttabledata.sas
First available in version: 1.2

%cstutil_resultsdsattr;

[ Exposure: internal ]
Defines the column attributes of the Results data set.

Use this macro in a statement level in a SAS DATA step, where a SAS ATTRIB
statement can be used.

File: cstutil_resultsdsattr.sas
First available in version: 1.2

%cstutil_resultsdskeep;

[ Exposure: internal ]
Specifies the Results data set columns to keep in a DATA step.

Use this macro in a statement level in a SAS DATA step, where a SAS KEEP
statement might be used.

File: cstutil_resultsdskeep.sas
First available in version: 1.2

%cstutil_saveresults(_cstIncludeValidationMetrics=0);

[ Exposure: internal ]
Saves process results to the file or files specified in SASReferences.

This macro saves process results to the file or files that are specified in
SASReferences with type= RESULTS values. If no SASReferences is available, no
save is attempted.

Expected Macro Variables:
_cstMetricsDS - Metrics data set
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
Parameters:
_cstIncludeValidationMetrics - - optional - Include process results in the
        validation metrics.
        Values: 0 | 1
        Default: 0
File: cstutil_saveresults.sas
First available in version: 1.2

%cstutil_setcstgroot;

[ Exposure: internal ]
Sets the global macro variable _cstGRoot.

This macro sets the _cstGRoot to the location of the SAS Clinical Standards
Toolkit global standards library.

In SAS Version 9.3 this value is stubbed in the cstutilsetcstgroot93 macro.
Later, the value is automatically generated by the SAS Clinical Standards
Toolkit framework after installation and configuration.

In SAS Version 9.4 the global macro variable is set to the system option
CSTGLOBALLIB

File: cstutil_setcstgroot.sas
First available in version: 1.2

%cstutil_setcstsroot;

[ Exposure: internal ]
Sets the global macro variable _cstSRoot.

This macro sets the _cstSRoot to the location of the SAS Clinical Standards
Toolkit sample library.

In SAS Version 9.3 this value is stubbed in the cstutilsetcstsroot93 macro.
Later, the value is automatically generated by the SAS Clinical Standards
Toolkit framework after installation and configuration.

In SAS Version 9.4 the global macro variable is set to the system option
CSTSAMPLELIB

File: cstutil_setcstsroot.sas
First available in version: 1.5

%cstutil_setmodel(_cstStd=&_cstStandard, _cstStdVer=&_cstStandardVersion);

[ Exposure: internal ]
Establishes the comparison reference metadata for a validation check.

This macro creates a copy of metadata for reference tables, source tables, and
columns in the SAS Work library. The metadata is based on library references
and file references that are specified in the SASReferences data set.

Comparison metadata for each check is based on the
validation_control.usesourcemetadata flag. If this flag is Y, sourcemetadata.*
is the comparison metadata. Otherwise, referencemetadata.* is the comparison
metadata.

This macro is called for each validation check, typically by either the
builddomlist macro or by multi-standard comparison check macros.

Assumptions:
1. In general, there should be only a single source of referencemetadata.*
that is specified in the SASReferences control data set. However, this
macro permits multiple sources. These sources are concatenated by this
macro during the derivation of the work._cstTableMetadata data set and
the work._cstColumnMetadata data set.
2. There can be multiple sources of sourcemetadata.* that are specified in
the SASReferences control data set. These sources are concatenated by
this macro during the derivation of the work._cstTableMetadata data set
and the work._cstColumnMetadata data set.

Expected Macro Variables:
_cstCheckID - Check ID from the run-time check metadata
_cstDebug - Turns debugging on or off for the session
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cstUseSourceMetadata - Use source table and column metadata (Y/N)
_cst_rc - Task error status
Parameters:
_cstStd - - required - The name of the registered standard. This
        parameter is typically used only with a validation that involves
        multiple standards.
        Default: &_cstStandard
_cstStdVer - - required - The version of _cstStd. This parameter is
        typically used only with a validation that involves multiple
        standards.
        Default: &_cstStandardVersion
File: cstutil_setmodel.sas
First available in version: 1.2

%cstutil_writecubexml(_cstXMLOut=, _cstEncoding=UTF-8, _cstMDPFile=, _cstDebug=);

[ Exposure: internal ]
Creates a temporary XML file that is used by the define.xml process.

The sole input to this macro is the MDP SAS data set that contains the
member names and the library references that are needed for the define process.
The sole output is the XML file, as specified by you.

Example:
%cstutil_writecubexml(_cstXMLOut=c:\crtdds\test2.xml,
_cstMDPFile=srcdata.mdp,
_cstDebug=1)

Parameters:
_cstXMLOut - - required - The destination and the filename for the XML
        output.
_cstEncoding - - optional - The XML encoding to use for the XML cube file.
        Default: UTF-8
_cstMDPFile - - required - The SAS data set that specifies the pointers
        to the data. This value must contain a libref (for example,
        srcdata.mdp). If a libref is omitted, this macro fails.
_cstDebug - - optional - Output information that is useful for validating
        the macro.
        Values: 0 | 1
        Default: 0
File: cstutil_writecubexml.sas
First available in version: 1.3

%cstutil_writemetric(_cstMetricParameter=, _cstResultID=, _cstResultSeqParm=, _cstMetricCnt=, _cstSrcDataParm=, _cstMetricsDSParm=&_cstMetricsDS);

[ Exposure: internal ]
Adds a single record to the Metrics data set based on parameter values.

This macro must be called outside the context of a DATA step. Instead, it can
be called after a DATA step boundary.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMetricsDS - Metrics data set
Parameters:
_cstMetricParameter - - required - The extensible set of metrics. This
        set can include, but is not limited to these:
        # of subjects
        # of records tested
        # of distinct check invocations
        Errors (severity=High) reported
        Warnings (severity=Medium) reported
        Notes (severity=Low) reported
        # of structural errors
        # of content errors
_cstResultID - - optional - The result ID. Typically, this value is set
        to either the validation check ID (for example, SDTM0001) or to a
        some more general summary value, such as METRICS.
_cstResultSeqParm - - optional - A link between the metrics and the
        results. Typically, this value is 1, unless duplicate values of the
        results ID need to be distinguished. This distinction is needed in
        certain instances, such as when the same validation check ID is
        invoked multiple times.
_cstMetricCnt - - required - The record counter for _cstMetricParameter.
_cstSrcDataParm - - optional - The information that links the metric back
        to the source. Example sources are the SDTM domain name or the
        calling validation code module.
_cstMetricsDSParm - - optional - The base (cross-check) Metrics data set
        to which the record is appended. By default, this value is the data
        set that is referenced by &_cstMetricsDS.
        Default: &_cstMetricsDS
File: cstutil_writemetric.sas
First available in version: 1.2

%cstutil_writeODMcubexml(_cstXMLOut=, _cstEncoding=UTF-8);

[ Exposure: internal ]
Creates a temporary XML file that is used in the derivation of an ODM XML file.

The ODM XML create (write) process defines a SAS libref (&_cstTempRefMdTable)
that is referenced here. This libref points to the ODM standard table and
column metadata used to build the ODMcubexml file.

EXAMPLE:
%cstutil_ODMwritecubexml(_cstXMLOut=c:\odm\test.xml)

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstTempRefMdTable - Library containing reference ODM table and
        column metadata
Parameters:
_cstXMLOut - - required - The destination and the filename for the XML
        output.
_cstEncoding - - optional - The XML encoding to use for XML cube file.
        Default: UTF-8
File: cstutil_writeodmcubexml.sas
First available in version: 1.4

%cstutil_writeresult(_cstResultID=, _cstValCheckID=, _cstResultParm1=, _cstResultParm2=, _cstResultSeqParm=1, _cstSeqNoParm=1, _cstSrcDataParm=, _cstResultFlagParm=0, _cstRCParm=0, _cstActualParm=, _cstKeyValuesParm=, _cstResultDetails=, _cstResultsDSParm=&_cstResultsDS);

[ Exposure: internal ]
Adds a single record to the Results data set based on parameter values.

This macro must be called outside the context of a DATA step. Instead, it can
be called after a DATA step boundary.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMessages - Cross-standard work messages data set
_cst_rc - Task error status
Parameters:
_cstResultID - - required - The result ID of the matching record in the
        Messages data set.
_cstValCheckID - - optional - (for validation processes) The validation
        check identifier from the validation_control data set.
_cstResultParm1 - - optional - The parameter to appear in the first
        substitution field of the associated message with the same result ID.
_cstResultParm2 - - optional - The parameter to appear in the second
        substitution field of the associated message with the same result
        ID.
_cstResultSeqParm - - optional - Typically, this value is 1, unless
        duplicate values of the results ID need to be distinguished. This
        distinction is needed in certain instances, such as when the same
        validation check ID is invoked multiple times.
        Default: 1
_cstSeqNoParm - - optional - The sequence number within _cstResultSeqParm,
        beginning with 1 and incremented by 1 for each observation to write
        to the Results data set.
        Default: 1
_cstSrcDataParm - - optional - The information that links the metric back
        to the source. Example sources are the SDTM domain name or the
        calling validation code module.
_cstResultFlagParm - - optional - A problem was detected. If this is an
        informational record rather than error record, this value is set to
        0. A positive value indicates that an error was detected. A negative
        value indicates that the check failed to run.
        Default: 0 (No)
_cstRCParm - - required - The value of _cst_rc at the point that the
        result is written to the Results data set.
        Default: 0
_cstActualParm - - optional - The source data value or values that caused
        the result to be written to the Results data set.
_cstKeyValuesParm - - optional - Information that links the result back
        to a specific source data record (for example, a data set key or
        XML row and column values).
_cstResultDetails - - optional - Run-time details about the result. These
        take precedence over metadata result details.
_cstResultsDSParm - - optional - The base (cross-check) Results data set
        to which this record is appended.
        Default: &_cstResultsDS
File: cstutil_writeresult.sas
First available in version: 1.2

%cstutiladddataset(_cstStd=, _cstStdVer=, _cstDS=, _cstInputDS=, _cstDSLabel=, _cstDSKeys=, _cstOverwrite=N);

[ Exposure: external ]
Adds a data set to the global standards library or the sample library.

This macro adds a SAS Clinical Standards Toolkit data set to the global
standards library or the sample library. The change is written to the global
standards library transaction log.

Example usage:
%cstutiladddataset(_cstStd=CDISC-SEND,_cstStdVer=3.0,
_cstDS=srcmeta.source_values,_cstInputDS=work.source_values,
_cstDSLabel=%str(Source Value Metadata),
_cstDSKeys=%str(sasref table column value),_cstOverwrite=Y)

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The name of the data set (in the form
        <Libname>.<DSname>) as it to be known in the global standards
        library or the sample library. Before invoking this macro, the
        libname must be initialized.
_cstInputDS - - required - The name of the source data set (in the form
        <Libname>.<DSname>)to write to the _cstDS destination. Before
        invoking this macro, the libname must be initialized.
_cstDSLabel - - optional - The data set label. Best practices recommend
        that every global standards library or sample library data set have
        a label.
_cstDSKeys - - optional - The data set keys. Best practices recommend
        that every global standards library or sample library data set have
        keys that uniquely identify records in the data set.
_cstOverwrite - - optional - Overwrite _cstDS if it exists.
        Values: Y | N
        Default: N
File: cstutiladddataset.sas
First available in version: 1.6

%cstutiladddscolumn(_cstStd=, _cstStdVer=, _cstDS=, _cstColumn=, _cstColumnLabel=, _cstColumnType=, _cstColumnLength=, _cstColumnFmt=, _cstColumnInitValue=);

[ Exposure: external ]
Adds a column to a SAS Clinical Standards Toolkit data set.

All actions that change the content of the data set are written to a
transaction file as specified by the SAS Clinical Standards Toolkit.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The <Libname>.<DSname> two-part SAS data set
        reference in which to add the column. Before invoking this macro,
        the libname must be initialized.
_cstColumn - - required - The column to add to _cstDS.
_cstColumnLabel - - required - The column label for the column to add.
_cstColumnType - - required - The column type for the column to add:
        C: Character
        N: Numeric
        Values: C | N
_cstColumnLength - - required - The NUMERIC column length for the column
        to add. The macro handles the $ in the length attribute for
        character data.
_cstColumnFmt - - optional - The column format for the column to add.
        For example, $12., 8.3, or BEST12.
_cstColumnInitValue - - optional - The column initial value for the
        column to add.
File: cstutiladddscolumn.sas
First available in version: 1.6

%cstutilappendmetadatarecords(_cstStd=, _cstStdVer=, _cstDS=, _cstNewDS=, _cstUpdateDSType=MERGE, _cstOverwriteDup=N, _cstTestMode=Y);

[ Exposure: external ]
Appends records to a SAS Clinical Standards Toolkit data set.

This macro appends a record/row to a SAS Clinical Standards Toolkit data set.
All actions that change the data set are written to the specified log file.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The <Libname>.<DSname> two-part SAS data set
        reference of the base data set to receive new data. Before invoking
        this macro, the libname must be initialized.
_cstNewDS - - required - The <Libname>.<DSname> two-part SAS data set
        reference that contains the records to append. Before invoking
        this macro, the libname must be initialized. If the strcuture of
        this data set does not match the structure that is specified in
        _cstDS, this macro stops processing without performing any action.
_cstUpdateDSType - - required - Append or merge the records into the
        _cstDS data set. If append, the new data is added to the _cstDS
        data set. If merge, the data from _cstNewDS updates existing records
        and adds new records. In either case, if keys exist, the data set is
        sorted.
        Values: MERGE | APPEND
        Default: MERGE
_cstOverwriteDup - - optional - Allow the appended records to overwrite
        records that exist in the base file. This parameter is used only
        when _cstUpdateDSType is specified as MERGE.
        Values: Y | N
        Default: N
_cstTestMode - - optional - Run the macro in test mode. In test mode,
        a WORK copy of the data set is created so that you can review it to
        determine whether modifications are accurate before the final data
        set is created. If this parameter is specified, you must run this
        macro a final time to instantiate the changes.
        Values: Y | N
        Default: Y
File: cstutilappendmetadatarecords.sas
First available in version: 1.6

%cstutilbuildattrfromds(_cstSourceDS=, _cstAttrVar=);

[ Exposure: external ]
Builds a DATA step ATTRIB statement based on columns in the input data set.

This macro builds ATTRIB statement content based on the columns identified in
the data set referenced in _cstSourceDS.

Example: var1 length=$8 label="Variable 1" format=$8.

Expected Macro Variables:
_cst_rc: - Error detection return code. If 1, error exists.
_cst_rcmsg: - Error return code message text
Parameters:
_cstSourceDS - - required - The source data set <libref.dset>.
_cstAttrVar - - required - The macro variable to contain the ATTRIB
        content.
File: cstutilbuildattrfromds.sas
First available in version: 1.6

%cstutilbuildmetadatafromsasrefs(cstSRefsDS=&_cstsasrefs, cstRefTabDS=work.reference_tables, cstRefColDS=work.reference_columns, cstSrcTabDS=, cstSrcColDS=);

[ Exposure: internal ]
Builds the framework reference_tables and reference_columns data sets.

This macro builds the framework reference_tables and reference_columns data
sets from a SASReferences data set (where filetype=DATASET).

NOTE: Libraries must be allocated before invoking this macro.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstLRECL - Logical record length setting for filename statement
_cstResultSeq - Results: Unique invocation of check
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
cstSRefsDS - - required - The SASReference data set. The value must use
        the format (libname.)member.
        Default: &_cstsasrefs
cstRefTabDS - - required - The reference metadata table metadata data set.
        The value must use the format (libname.)member.
        Default: work.reference_tables
cstRefColDS - - required - The reference metadata column metadata data
        set. The value must use the format (libname.)member.
        Default: work.reference_columns
cstSrcTabDS - - optional - The source metadata table metadata data set.
        The value must use the format (libname.)member. If this parameter
        is not specified, no source metadata is created. By default, this
        is a copy of cstRefTabDS.
cstSrcColDS - - optional - The source metadata column metadata data set.
        The value must use the format (libname.)member. If this parameter
        is not specified, no source metadata is created. By default, this
        is a copy of cstRefColDS.
File: cstutilbuildmetadatafromsasrefs.sas
First available in version: 1.5

%cstutilbuildstdvalidationcode(_cstStdDS=work._cstStandardsforIV, _cstSampleRootPath=, _cstSampleSASRefDSPath=, _cstSampleSASRefDSName=, _cstCallingDriver=Unspecified);

[ Exposure: external ]
Generates the validation-specific macro _cstreadStds to build the workflow.

This macro is called in the internal validation driver programs. This macro
generates the validation-specific macro _cstreadStds to build a job stream for
all registered standards that are passed to cstutilbuildstdvalidationcode() in
the data set that is specified in _cstStdDS.

NOTE: An external filename INCCODE statement is required before invoking this
macro. For example:
filename incCode CATALOG "work._cstCode.stds.source" &_cstLRECL

          
History:
   2013-11-15
Abort with any prior fatal error (1.6)
Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
Parameters:
_cstStdDS - - optional - The set of standards to validate, using the
        the structure of the <global standards library>/standards/
        cst-framework-1.5/templates/standards
        data set.
        Default: work._cstStandardsforIV
_cstSampleRootPath - - optional - The root path to a study-specific
        location that contains study files. To valide multiple standards,
        this path must be generic (valid) across those standards. If this
        path is unique to each standard, this macro must be called for each
        standard, and _cstStdDS must contain only the one record for that
        standard.
        To use the studylibraryrootpath folder hierarchy convention, as
        defined in the <global standards library>/metadata standards data
        set, specify the value _DEFAULT_. If this parameter is specified,
        specify non-null values for _cstSampleSASRefDSPath and
        _cstSampleSASRefDSName. If either _cstSampleSASRefDSPath or
        _cstSampleSASRefDSName is specified, _cstSampleRootPath must be
        non-null.
_cstSampleSASRefDSPath - - optional - The path to a study-specific
        location that contains the SASReferences data set to use. If this
        parameter is specified, specify the value of either _DEFAULT_ or the
        full path to the data set (excluding the name of the file). If the
        SASReferences data set is created in this macro, you can specify the
        value &workpath.
        To validate multiple standards, this path must be generic (valid)
        across those standards. If this path is unique to each standard,
        this macro must be called for each standard, and _cstStdDS must
        contain only the one record for that standard.
        To use the studylibraryrootpath/control folder hierarchy convention
        that is used with the cstSampleLibrary, specify the value _DEFAULT_.
_cstSampleSASRefDSName - - optional - The name of the SASReferences data
        set within _cstSampleSASRefDSPath. The rules that apply to
        _cstSampleSASRefDSPath apply to this parameter, too.
        To use stdvalidation_sasrefs.sas7bdat that is used with the
        cstSampleLibrary, specify the value _DEFAULT_.
_cstCallingDriver - - optional - The name of the driver module calling
        this macro.
File: cstutilbuildstdvalidationcode.sas
First available in version: 1.5

%cstutilcheckforproblem(_cstRsltID=, _cstChkID=, _cstType=STD);

[ Exposure: internal ]
Handles any error condition that sets error condition _cst_rc to 1.

The error condition results after a call to any SAS Clinical Standards Toolkit
macro.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstRsltID - - required - The error number (for example, CST0008) to
        report in the Results data set.
_cstChkID - - optional - The check number to report in the Results data
        set.
_cstType - - required - Evaluate STD or SAMPLE files.
        Values: STD | SAMPLE
        Default: SAMPLE
File: cstutilcheckforproblem.sas
First available in version: 1.5

%cstutilcheckjava;

[ Exposure: internal ]
Determines whether issues related to Java exist in the previous DATA step.

This macro must be called immediately after the DATA step that declares the
Java object.

The following Java issues and issues related to Java are caught:
1. No Java installed:
ERROR: The Java proxy is not responding.
ERROR: The Java proxys JNI call to start the VM failed.
ERROR: Could not create Java VM.
SYSERR 0
SYSERRORTEXT Could not create Java VM.

2. No picklist:
ERROR: The Java picklist file was not found.
ERROR: Could not initialize classpath from picklist file.
SYSERR 0
SYSERRORTEXT Could not initialize classpath from picklist file.

3. Edit picklist has the wrong content:
ERROR: File(s) are missing from the Java repository.
ERROR: Could not initialize classpath from picklist file.
SYSERR 0
SYSERRORTEXT Could not initialize classpath from picklist file.

4. Missing JAR file:
ERROR: Could not find class
com/sas/ptc/transform/xml/StandardXMLTransformerParams at line 3
column 22. Please ensure that the CLASSPATH is correct.
ERROR: DATA STEP Component Object failure.
Aborted during the EXECUTION phase.
SYSERR 1012
SYSERRORTEXT DATA STEP Component Object failure.
Aborted during the EXECUTION phase

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstResultsDS - Results data set
File: cstutilcheckjava.sas
First available in version: 1.5

%cstutilcheckwriteaccess(_cstFileType=, _cstFilePath=, _cstFileRef=);

[ Exposure: external ]
Checks for Write access for an output object.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstFileType - - required - The type of object to check within the SAS
        Clinical Standards Toolkit:
        CATALOG: Checks for Write access to a SAS format catalog that is
        specified in _cstFileRef. This macro requires that the
        libname be assigned before invoking this macro. A two-part
        filename is required (for example, mysas.formats) for a
        catalog in _cstfileref.
        DATASET: Checks for Write access to a SAS data set that is specified
        in _cstFileRef. The libname must be assigned before
        invoking this macro.
        FILE: Checks for Write access to a file that is specified in
        _cstFilePath _cstFileRef.
        FOLDER: Checks for Write access to a folder that is specified in
        _cstfilepath.
        LIBNAME: Checks for Write access to a SAS libname that is specified
        in _cstfileref.
        Values: CATALOG | DATASET | FILE | FOLDER | LIBNAME
_cstFilePath - - conditional - The physical path of the file or folder to
        check. Required only when _cstFileType is FOLDER or FILE (for
        example, _cstfilepath=C:\cstSampleLibrary\cdisc-sdtm-3.1.2).
_cstFileRef - - required - The name of the object to check. For example:
        _cstFileType=CATALOG _cstFileRef=cat1.formats
        _cstFileType=DATASET _cstFileRef=mysas.dm
        _cstFileType=FILE _cstFileRef=dm.sas7bdat
        _cstFileType=FOLDER _cstFileRef=
        _cstFileType=LIBNAME _cstFileRef=mysas
File: cstutilcheckwriteaccess.sas
First available in version: 1.5

%cstutilcomparestructure(_cstReturn=_cst_rc, _cstReturnMsg=_cst_rcmsg, _cstBaseDSName=, _cstCompDSName=, _cstResultsDS=work._cstCompareStructure);

[ Exposure: external ]
Compares the metadata structure of two data sets.

This macro stores a return code in _cstReturn. The value of the return code
provides information about the result of the comparison. By inspecting the
value of _cstReturn after this macro runs, you can use the results of this to
determine a course of action or the parts of a SAS program to execute.

The following table is the key to interpret the _cstReturn return code. For
each of the conditions listed, if the condition is true, the associated bit is
set in the return code. Thus, the _cstReturn return code is the sum of the
codes that are listed in this table:

Bit Condition Code Description
=== ========= ==== ==================================================
1 DSLABEL 1 Data set labels differ
2 INFORMAT 2 Variable has different informat
3 FORMAT 4 Variable has different format
4 LABEL 8 Variable has different label
5 TYPE 16 Variable has different datatype
6 LENGTH 32 Variable has different length
7 BASEVAR 64 Base data set has variables not in comparison
8 COMPVAR 128 Comparison data set has variables not in base

These codes are ordered and scaled to enable a simple check of the degree to
which the data sets differ in structure. For example, if you want to check
whether two data sets contain the same variables, but you do not care about
differences in labels, informats, and formats, use the following statements
after running this macro:

%if &_cst_rc >= 16 %then
%do;
handle error;
%end;

You can examine individual bits in _cstReturn by using DATA step bit-testing
features to check for specific conditions. For example, to chceck for the
presence of observations in the base data set that are not in the comparison
data set, use the following statements:

data _null_;
if &_cst_rc='1'b
then put 'Data set labels differ';
if &_cst_rc='1.'b
then put 'Variable has different informat';
if &_cst_rc='1..'b
then put 'Variable has different format';
if &_cst_rc='1...'b
then put 'Variable has different label';
if &_cst_rc='1....'b
then put 'Variable has different datatype';
if &_cst_rc='1.....'b
then put 'Variable has different length';
if &_cst_rc='1......'b
then put 'Base data set has variables not in comparison';
if &_cst_rc='1.......'b
then put 'Comparison data set has variables not in base';
run;

The Results data set has the following structure:

baseDS char(50) label='Base data set name'
compDS char(50) label='Comparison data set name'
Name char(32) label='Variable name'
Issue char(8) label='Issue (code)'
Description char(50) label='Issue description'
baseValue char(256) label='Value in base data set'
compValue char(256) label='Value in comparison data set'

Expected Macro Variables:
&_cstReturn - Task error status
&_cstReturnMsg - Message associated with _cst_rc
_cstDebug - Turns debugging on or off for the session
Parameters:
_cstReturn - - required - The macro variable that contains the return
        value that is set by this macro.
        Default: _cst_rc
_cstReturnMsg - - required - The macro variable that contains the return
        message that is set by this macro.
        Default: _cst_rcmsg
_cstBaseDSName - - required - The reference data set, typically a
        zero-observation template data set.
_cstCompDSName - - required - The data set that is compared against the
        reference data set.
_cstResultsDS - - optional - The data set in which to save the detailed
        results.
        Default: work._cstCompareStructure.
File: cstutilcomparestructure.sas
First available in version: 1.5

%cstutilcreateattribfromds(_cstDataSetName=, _cstAttrFileref=, _cstRptType=LOG);

[ Exposure: internal ]
Creates a DATA step ATTRIB statement for all columns in a specified data set.

If the data set does not exist or cannot be opened, an error occurs.

NOTE: An external filename statement is required before calling this macro.
For example:
filename incCode CATALOG "work._cstCode.attrib.source" &_cstLRECL

Parameters:
_cstDataSetName - - required - The (libname.)memname of the data set.
        If a libname is not specified, WORK is assumed.
_cstAttrFileref - - required - The fileref that points to the physical
        file or catalog entry that contains the generated ATTRIB statement.
        It is assumed that this fileref will be %included in the calling
        program.
_cstRptType - - optional - Report any problems in the SAS log or in the
        Results data set.
        Default: LOG
File: cstutilcreateattribfromds.sas
First available in version: 1.5

%cstutilcreatetablesfrommetadata(_cstReturn=_cst_rc, _cstReturnMsg=_cst_rcmsg, _cstTableMD=, _cstColumnMD=, _cstOutputLibrary=, _cstNumObs=0, _cstWhereClause=);

[ Exposure: external ]
Creates table shells from metadata.

This macro generates all of the table shells that are defined in tables and
columns metadata data sets. The table shells are stored in a library that is
specified by the caller.

A table shell for metadata data sets can be created by calling these macros:

%cst_createdsfromtemplate(_cstStandard=CDISC-SDTM,
_cstType=referencemetadata,
_cstSubType=table,
_cstOutputDS=work.source_tables);

%cst_createdsfromtemplate(_cstStandard=CDISC-SDTM,
_cstType=referencemetadata,
_cstSubType=column,
_cstOutputDS=work.source_columns);

Required fields for the metadata input data sets are listed below. Variables
common to both data sets must match in data type and length.

_cstTableMD - requires TABLE and LABEL variables
_cstColumnMD - requires TABLE, ORDER, COLUMN, LABEL, TYPE, and
DISPLAYFORMAT variables.

Parameters:
_cstReturn - - required - The macro variable that contains the return
        value that is set by this macro: 0 (no error), 1 (error)
        Default: _cst_rc
_cstReturnMsg - - required - The macro variable that contains the return
        message that is set by this macro. If _cstReturn=1, there is a
        message.
        Default: _cst_rcmsg
_cstTableMD - - required - The two-level data set name of the table that
        contains the table metadata.
_cstColumnMD - - required - The two-level data set name of the table that
        contains the column metadata.
_cstOutputLibrary - - required - The libname in which the table shells
        are created.
_cstNumObs - - optional - The number of records in the data sets to
        create. By default, zero-observation data sets are created. If you
        specify a value other than 0, the data sets to create contain one
        observation with all fields missing.
        Default: 0
_cstWhereClause - - optional - A valid SAS WHERE clause used in the PROC
        SORT to subset by table. By default, no WHERE clause is submitted.
        This parameter relies on a syntactically valid WHERE statement.
        Example:
        _cstWhereClause=%nrstr(WHERE table in ('AE','DM','TA'))
        _cstWhereClause=%nrstr(WHERE table = 'AE')
        Default: <blank>
File: cstutilcreatetablesfrommetadata.sas
First available in version: 1.6

%cstutildeletedscolumn(_cstStd=, _cstStdVer=, _cstDS=, _cstColumn=, _cstMustBeEmpty=Y, _cstTestMode=Y);

[ Exposure: external ]
Deletes a column from a SAS Clinical Standards Toolkit data set.

All actions that change the content of the data set are written to the
specified log file.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The <Libname>.<DSname> two-part SAS data set
        reference that contains the column to delete. Before invoking this
        macro, the libname must be initialized.
_cstColumn - - required - The column in _cstDS to delete. Only one column
        can be deleted at a time.
_cstMustBeEmpty - - required - Determine whether all column values are
        empty before deleting a column. If Y or missing, delete the column
        only if all the values are empty. If N, delete the column without
        regard to the values.
        Values Y | N
        Default: Y
_cstTestMode - - optional - Run the macro in test mode. In test mode,
        a WORK copy of the data set is created so that you can review it to
        determine whether modifications are accurate before the final data
        set is created. If this parameter is specified, you must run this
        macro a final time to instantiate the changes.
        Values: Y | N
        Default: Y
File: cstutildeletedscolumn.sas
First available in version: 1.6

%cstutildeletemetadatarecords(_cstStd=, _cstStdVer=, _cstDS=, _cstDSIfClause=, _cstTestMode=Y);

[ Exposure: external ]
Deletes an observation from a SAS Clinical Standards Toolkit data set.

This macro deletes a record/row from the specified data set. All actions that
change the content of the data set are written to the specified log file.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The <Libname>.<DSname> two-part SAS data set
        reference that contains the records to delete. Before invoking this
        macro, the libname must be initialized.
_cstDSIfClause - - required - A SAS subset clause used in an IF statement
        that identifies the records to delete. All records that match the
        criteria of this clause are deleted. Clauses that are syntactically
        incorrect or contain nonexistent column references generate errors
        and cause the macro to exit without performing any actions. The
        syntax can delete from 0 to all records. If all records are deleted,
        this macro aborts because it assumes that there is a problem with
        the IF clause.
        Example:
        _cstDSIfClause=%str(checkid='SDTM0412' and standard='CDISC-SDTM'
        and standardversion='***' and checksource='SAS' and
        uniqueid='SDTM004121CST150SDTM3132013-03-07T18:15:21CST')
_cstTestMode - - optional - Run the macro in test mode. In test mode,
        a WORK copy of the data set is created so that you can review it to
        determine whether modifications are accurate before the final data
        set is created. If this parameter is specified, you must run this
        macro a final time to instantiate the changes.
        Values: Y | N
        Default: Y
File: cstutildeletemetadatarecords.sas
First available in version: 1.6

%cstutildropmissingvars(_cstDataSetName=, _cstDataSetOutName=, _cstNoDrop=);

[ Exposure: internal ]
Drops variables from a data set that have only missing values.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstDataSetName - - required - The (libname.)memname of the data set.
_cstDataSetOutName - - required - The (libname.)memname of the output
        data set.
_cstNoDrop - - optional - The list of the variables that will not be
        dropped, even if they have only missing values.
        This list can contain a number of blank-separated variables or any
        valid variable shortcut like _Numeric_, _character_, c:, var1-var3,
        varx -- varz.
File: cstutildropmissingvars.sas
First available in version: 1.5

%cstutilfindvalidfile(_cstFileType=, _cstFilePath=, _cstFileRef=);

[ Exposure: external ]
Checks whether a folder, file, data set, catalog, or catalog member exists.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstFileType - - required - The type of object to check within the SAS
        Clinical Standards Toolkit:
        CATALOG: Checks for the existence of a SAS fomat catalog or catalog
        member that is specified in _cstFileRef. This macro
        requires that the libname be assigned before invoking this
        macro. A two-part file name is required for a catalog (for
        example, mysas.formats). A four-part name is required for
        a catalog member (for example, mysas.formats.race.formatc).
        DATASET: Checks for the existence of a SAS dataset that is specified
        in _cstFileRef. The libname must be assigned before
        invoking this macro.
        VIEW: Checks for the existence of a SAS view that is specified in
        _cstFileRef. The libname must be assigned before invoking
        this macro.
        FILE: Checks for the existence of a file that is specified in
        _cstFilePath and _cstFileRef.
        FOLDER: Checks for the existence of a folder that is specified in
        _cstFilePath.
        Values: CATALOG | DATASET | VIEW | FILE | FOLDER
_cstFilePath - - conditional - The physical path of the file or folder to
        check. Required when _cstFileType is FILE or FOLDER (for example,
        _cstFilePath=C:\cstSampleLibrary\cdisc-sdtm-3.1.2).
_cstFileRef - - required - The name of the object to check.
        _cstFileType=CATALOG for catalog _cstFileRef=cat1.format
        _cstFileType=CATALOG for member _cstFileRef=cat1.formats.sex.formatc
        _cstFileType=DATASET _cstFileRef=mysas.dm
        _cstFileType=VIEW _cstFileRef=mysas.dmview
        _cstFileType=FILE _cstFileRef=dm.sas7bdat
        _cstFileType=FOLDER _cstFileRef=
File: cstutilfindvalidfile.sas
First available in version: 1.5

%cstutilgetattribute(_cstDataSetName=_last_, _cstVarName=, _cstAttribute=);

[ Exposure: internal ]
Gets attribute information from a data set or variable.

If the data set does not exist or cannot be opened, an error occurs.

For data set attributes, this macro uses the attrc and attrn functions. For
data set variable attributes, this macro uses the VAR* functions (VARFMT,
VARINFMT, VARLABEL, VARLEN, VARNAME, VARNUM, and VARTYPE).

Examples:
%put %cstutilgetattribute(_cstDataSetName=sashelp.class, _cstVarName=name,
_cstAttribute=VARTYPE)
%put %cstutilgetattribute(_cstDataSetName=sashelp.class, _cstVarName=name,
_cstAttribute=VARLEN)
%put %cstutilgetattribute(_cstDataSetName=sashelp.class, _cstVarName=name,
_cstAttribute=VARLABEL)
%put %cstutilgetattribute(_cstDataSetName=sashelp.class, _cstVarName=name,
_cstAttribute=VARFMT)
%put %cstutilgetattribute(_cstDataSetName=sashelp.class, _cstVarName=name,
_cstAttribute=VARNUM)
%put %cstutilgetattribute(_cstDataSetName=sashelp.class, _cstAttribute=NOBS)
%put %cstutilgetattribute(_cstDataSetName=sashelp.classE, _cstAttribute=NVARS

Parameters:
_cstDataSetName - - required - The (libname.)memname of the data set.
        Default: _last_
_cstVarName - - optional - The variable name in the data set.
_cstAttribute - - required - The attribute to get.
File: cstutilgetattribute.sas
First available in version: 1.6

%cstutilgetdslock(_cstLockDS=, _cstWaitTime=60);

[ Exposure: external ]
Attempts to get a data set lock to support subsequent data set updates.

This macro attempts to get a data set lock before making updates to that data
set. If a lock cannot be obtained, the attempt is aborted. If a lock is
obtained, a subsequent call to cstutilreleasedslock is required.

Expected Macro Variables:
_cstTransactionDS: - Data set that contains one or more transactions to
        be logged
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstLockDS - - optional - The data set <libref.dset> to lock and update.
        A parameter value is not required, and if this parameter is not
        specified, the default data set used is derived from the
        CST_LOGGING_PATH and CST_LOGGING_DS static variables.
_cstWaitTime - - optional - The number of seconds to attempt to get the
        data set lock before aborting the attempt.
        Default: 60
File: cstutilgetdslock.sas
First available in version: 1.6

%cstutillogevent(_cstLockDS=, _cstUpdateDS=);

[ Exposure: external ]
Logs a file operation in the specified log file.

This macro attempts to get a data set lock before making updates to that data
set. If a lock cannot be obtained, the attempt is aborted. If a lock is
obtained, a subsequent call to cstutilreleasedslock is required.

Expected Macro Variables:
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstLockDS - - required - The data set <libref.dset> that contains
        transactions of interest. This is the data set locked by
        cstutilgetdslock.
_cstUpdateDS - - required - The data set <libref.dset> that contains
        transactions to log.
File: cstutillogevent.sas
First available in version: 1.6

%cstutilmodifycolumnattribute(_cstStd=, _cstStdVer=, _cstDS=, _cstColumn=, _cstAttr=, _cstAttrValue=, _cstTestMode=Y);

[ Exposure: external ]
Modifies column attributes of a SAS Clinical Standards Toolkit data set.

All actions that change the content of the data set are written to a
transaction file as specified by the SAS Clinical Standards Toolkit.
The macro will NOT allow a change in length of a numeric column.
When changing character lengths this utility will check the actual data in the
data set to determine if any data will be truncated. If truncation will result
from this operation the utilty will inform the user and %* will not continue.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The <Libname>.<DSname> two-part SAS data set
        reference for the column modification. Before invoking this macro,
        the libname must be initialized.
_cstColumn - - required - The column to modify in _cstDS.
_cstAttr - - required - The attribute to modify.
        Values: FORMAT | INFORMAT | LENGTH | LABEL | TRANSCODE
_cstAttrValue - - required - The valid value for the attribute specified
        in _cstATTR. NOTE: Do not encase the parameter value in quotation
        marks.
_cstTestMode - - optional - Run the macro in test mode. In test mode,
        a WORK copy of the data set is created so that you can review it to
        determine whether modifications are accurate before the final data
        set is created. If this parameter is specified, you must run this
        macro a final time to instantiate the changes.
        Values: Y | N
        Default: Y
File: cstutilmodifycolumnattribute.sas
First available in version: 1.6

%cstutilnobs(_cstDataSetName=_last_);

[ Exposure: internal ]
Returns the number of observations in a data set or an error.

If the data set does not exist or cannot be opened, an error occurs.

These actions occur:
1. The macro attempts to open the data set.
If the data set cannot be opened, an error message is returned and
processing stops.
2. The macro checks the values of the data set attributes ANOBS (Does SAS know
how many observations there are?) and WHSTMT (Is a WHERE statement in
effect?).
3. If SAS knows the number of observations and there is no WHERE clause, the
value of the data set attribute NLOBS (number of logical observations) is
returned.
4. If SAS does not know the number of observations (perhaps this is a view or
transport data set) or if a WHERE clause is in effect, a forced read is done
of the data set using NLOBSF. (NOTE: that this can be slow for large data
sets.)
If the data set exists, the value returned is a whole number. If the data
set cannot be opened, a period (the default missing value) is returned.

Examples:
%put %cstutilnobs(_cstDataSetName=sashelp.class)
%put %cstutilnobs(_cstDataSetName=sashelp.class(where=(sex="M")))
%put %cstutilnobs(_cstDataSetName=sashelp.vtable)
title "sashelp.class has %cstutilnobs(_cstDataSetName=sashelp.class) obs"

Parameters:
_cstDataSetName - - required - The (libname.)memname of the data set.
        Default: _last_
File: cstutilnobs.sas
First available in version: 1.5

%cstutilprocessfailed(_cstResDS=&_cstResultsDS);

[ Exposure: external ]
Returns a boolean to indicate whether a process failed.

This macro returns a boolean to indicate whether a SAS Clinical Standards
Toolkit process failed, where 0=successful completion and 1=failure.

Example usage:
%put %cstutilprocessfailed
%put %cstutilprocessfailed(_cstResDS=mylib.results)
%put %cstutilprocessfailed(_cstResDS=_cstresultsDS)
%if %cstutilprocessfailed(_cstResDS=results)=1 %then
%put ====> Process failed

Parameters:
_cstResDS - - optional - The Results data set for the process. Must be in
        the format (libname.)member.
        Default: &_cstResultsDS
File: cstutilprocessfailed.sas
First available in version: 1.5

%cstutilprocessxmllog(_cstReturn=_cst_rc, _cstReturnMsg=_cst_rcmsg, _cstLogXMLPath=, _cstScope=USER);

[ Exposure: internal ]
Processes the XML log file that was created by the Java XMLTransformer process.

Processes the log file that was created by the XMLTransform Java process and
adds messages to the Results dataset.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstReturn - - required - The macro variable that contains the return
        value that is set by this macro. 0=No error, 1=Error
        Default: _cst_rc
_cstReturnMsg - - required - The macro variable that contains the return
        message that is set by this macro. If _cstReturn=1 there is a
        message.
        Default: _cst_rcmsg
_cstLogXMLPath - - required - The complete path to the XML log file
_cstScope - - required - The space-separated list of the message scope
        values be add to the Results data set.
        Values: USER | SYSTEM | _ALL_
        Default: USER
File: cstutilprocessxmllog.sas
First available in version: 1.6

%cstutilsetcstgroot93;

[ Exposure: internal ]
Sets the global macro variable _cstGRoot for SAS 9.3.

This macro sets the global macro variable _cstGRoot to the location of the SAS
Clinical Standards Toolkit global standards library. The value is stubbed in
here. Later, the value is automatically generated by the SAS Clinical
Standards Toolkit framework after installation and configuration.

File: cstutilsetcstgroot93.sas
First available in version: 1.2

%cstutilsetcstsroot93;

[ Exposure: internal ]
Sets the global macro variable _cstSRoot for SAS 9.3.

This macro sets the global macro variable _cstSRoot to the location of the SAS
Clinical Standards Toolkit sample library. The value is stubbed in here.
Later, the value is automatically generated by the SAS Clinical Standards
Toolkit framework after installation and configuration.

File: cstutilsetcstsroot93.sas
First available in version: 1.5

%cstutiltrimcharvars(_cstDataSetName=, _cstDataSetOutName=, _cstNoTrim=);

[ Exposure: internal ]
Trims character variables to their minimum lengths.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstDataSetName - - required - The (libname.)memname of the data set.
_cstDataSetOutName - - required - The (libname.)memname of the output
        data set.
_cstNoTrim - - optional - The list of blank-delimited variables not to
        trim.
File: cstutiltrimcharvars.sas
First available in version: 1.5

%cstutilupdatemetadatarecords(_cstStd=, _cstStdVer=, _cstDS=, _cstDSIfClause=, _cstColumn=, _cstValue=, _cstTestMode=Y);

[ Exposure: external ]
Updates an observation in a SAS Clinical Standards Toolkit data set.

This macro updates a record/row in the specified data set. All actions that
change the data set are written to the specified log file.

Expected Macro Variables:
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_rc: - Error detection return code (1 indicates an error)
_cst_rcmsg: - Error return code message text
Parameters:
_cstStd - - required - The name of the data standard. For example,
        CDISC-SDTM.
_cstStdVer - - required - The version of the data standard. For example,
        3.1.4.
_cstDS - - required - The <Libname>.<DSname> SAS data set to modify.
        Before invoking this macro, the libname must be initialized.
_cstDSIfClause - - required - A SAS subset clause that specifies the
        records to update. The clause is used only in an IF statement and
        must adhere to the syntax rules of an IF statement.
        All records that match the criteria of the clause are updated.
        Clauses that are syntactically incorrect (for example,
        %str(keys ? 'TRT')) or contain non-existent column references
        generate errors and cause the macro to exit without performing any
        action.
        NOTE: Double quotation marks are translated into single quotation
        marks to simplify processing. Single apostrophes in the string
        must be changed to double apostrophes. For example,
        comment="Event can''t happen").
        The syntax can update from 0 to all records.
        Example: Modify the keys for the TR domain in reference_tables
        _cstDSIfClause=%str(sasref='REFMETA' and table='TR')
_cstColumn - - required - The name of the column in _cstDS. Only one
        column can be specified.
        Limitation: Data set keys cannot be updated using this macro. Use
        cstutilappendmetadatarecords() instead.
_cstValue - - required - The new value of _cstDS._cstColumn. You must
        a valid type-specific value for _cstColumn. Null character values
        must be specified as %str( ).
_cstTestMode - - optional - Run the macro in test mode. In test mode,
        a WORK copy of the data set is created so that you can review it to
        determine whether modifications are accurate before the final data
        set is created. If this parameter is specified, you must run this
        macro a final time to instantiate the changes.
        Values: Y | N
        Default: Y
File: cstutilupdatemetadatarecords.sas
First available in version: 1.6

%cstutilvalidatesasreferences(_cstDSName=&_cstSASRefs, _cstStandard=CST-FRAMEWORK, _cstStandardversion=1.2, _cstSASRefsGoldStd=, _cstallowoverride=, _cstResultsType=LOG, _cstPreAllocated=N, _cstVerbose=N);

[ Exposure: external ]
Validates the structure and content of a SASReferences data set.

This macro is typically used is these ways:
1. As a part of the normal process setup, called either prior to or as a
part of cstutil_allocatesasreferences()
2. As a standalone call outside the context of use within the SAS Clinical
Toolkit process setup

The macro sets the _cst_rc and _cst_rcmsg global macro variables to indicate
that the SASReferences data set is valid (_cst_rc=0) or not valid
(_cst_rc ne 0).

These are the conditions that are checked by this macro:
1. The data set is structurally correct. (CHK01)
2. An unknown standard or standardversion exists. (CHK02)
3. The referenced input and output files and folders can be accessed. (CHK03)
4. All required look-throughs to Global Library defaults work. (CHK04)
5. All discrete character field values are found in the standard lookup.
(CHK05)
6. For the given context, path and memname macro variables are resolved.
(CHK06)
7. Multiple fmtsearch records exist but valid ordering is not provided.
(CHK07)
8. Multiple autocall records exists but valid ordering is not provided.
(CHK08)

          
History:
   2013-12-04
Now temporarily allocate _cstCWA in CHK03 when
_cstPreAllocated=N for verification of SAS files.
Expected Macro Variables:
_cstDeBug - Turns debugging on or off for the session
_cstLRECL - Logical record length setting for filename statement
_cstMessages - Cross-standard work messages data set
_cstResultSeq - Results: Unique invocation of check
_cstSASRefs - Run-time SASReferences data set derived in process
        setup
_cstSASRefsLoc - SASReferences file location
_cstSASRefsName - SASReferences file name
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cst_MsgID - Results: Result or validation check ID
_cst_MsgParm1 - Messages: Parameter 1
_cst_MsgParm2 - Messages: Parameter 2
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstDSName - -required - The SASReferences data set in the format
        (libname.)member. If a value is not provided, this macro attempts to
        derive a value by using the following sequence:
        1. Use the global macro variables _cstSASRefsLoc and
        _cstSASRefsName.
        2. Use the global macro variable _cstSASRefs.
        3. Abort.
_cstStandard - - required - The name of a registered standard.
        Default: CST-FRAMEWORK
_cstStandardversion - - required - The version of a registered standard.
        Default: 1.2
_cstSASRefsGoldStd - - required - The comparative gold standard against
        which this SASReferences file is compared. By default, the Global
        Library metadata standardsasreferences is assumed. If provided, use
        the format (libname.)member.
_cstallowoverride - - optional - Ignore one or more of the conditions
        defined above. Specify the check code in a blank-delimited string
        (for example, CHK01 CHK07). If null, all conditions are tested.
_cstResultsType - - required - Report findings in the SAS log or in the
        Results data set.
        Values: LOG | RESULTS
        Default: LOG
_cstPreAllocated - - required - Allocate librefs and filerefs when this
        macro is called. If not, validation of data sets and catalogs is
        performed based on paths and memnames, not libref.memnames.
        Values: N|Y
        Default: N
_cstVerbose - - required - Report specific problems and the absence of
        problems. Otherwise, report only success or failure in _cst_rc.
        Values: N|Y
        Default: N
File: cstutilvalidatesasreferences.sas
First available in version: 1.5

%cstutilvalidationsummary(_cstResDS=&_cstResultsDS, _cstProcessSummary=N, _cstSeverityList=Note Warning Error);

[ Exposure: external ]
Summarizes the contents of the validation process Results data set.

For validation processes, this macro evaluates the resultflag column of the
process Results data set to provide an overall assessment of each validation
process. One of four summary conditions are reported:
-1 No validation warnings or errors reported, but some checks not run
0 No validation warnings or errors reported
1 1+ validation warnings or errors reported
2 1+ validation warnings or errors reported, but some checks not run

Example usage:
%cstutilvalidationsummary
%cstutilvalidationsummary(_cstResDS=myreslts.results)

Expected Macro Variables:
_cstResultFlag - Results: Problem was detected
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstSrcData - Results: Source entity being evaluated
_cst_MsgID - Results: Result or validation check ID
_cst_MsgParm1 - Messages: Parameter 1
_cst_MsgParm2 - Messages: Parameter 2
_cst_rc - Task error status
Parameters:
_cstResDS - - optional - The Results data set for the process.
        Use the format (libname.)member.
        Default: &_cstResultsDS
_cstProcessSummary - - optional - Generate a PROCESS SUMMARY: prefix to
        the beginning of the message (when called by a SAS Clinical
        Standards Toolkit validation macro).
        Values: N | Y
        Default: N
_cstSeverityList - - optional - The list of check severity values, space-
        delimited, to include when summarizing the validation process.
        Values: Note Warning Error
        Default: Note Warning Error
File: cstutilvalidationsummary.sas
First available in version: 1.5

%cstutilwriteresultsintro(_cstProcessType=REPORTING, _cstPgm=);

[ Exposure: internal ]
Adds intro records to the Results data set.

This macro gets the name of the currently executing SAS program. The program
name can be extracted in batch mode or when executing after the program file
is opened by the SAS Enhanced Editor in Windows environments.

You can specify the program name in the _cstPGM parameter. The macro uses this
name only when the macro cannot determine the program name.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstResultFlag - Results: Problem was detected
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstStandard - Name of a standard registered to the SAS Clinical
        Standards Toolkit
_cstStandardVersion - Version of the standard referenced in _cstStandard
_cstVersion - Version of Clinical Standards Toolkit
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstProcessType - Parameter description not provided
_cstPgm - - optional - The name of the driver module calling this macro.
File: cstutilwriteresultsintro.sas
First available in version: 1.5

%cstutilxmlvalidate(_cstSASReferences=&_cstSASRefs, _cstLogLevel=info, _cstCallingPgm=None or unspecified);

[ Exposure: external ]
Performs XML schema-level validation on a supported XML standard file.

General use of this macro is in combination with another macro (such as
reading or writing an XML file). If this macro is run independently,
a valid SASReferences data set is required.

Expected Macro Variables:
_cstDebug - Turns debugging on or off for the session
_cstGRoot - Root path of the global standards library
_cstResultFlag - Results: Problem was detected
_cstResultSeq - Results: Unique invocation of check
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstVersion - Version of the SAS Clinical Standards Toolkit
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
studyOutputPath - Study-specific output root path
studyRootPath - Root path of the study library
Parameters:
_cstSASReferences - - required - The SASReferences data set that specifies
        the location of the XML file to evaluate and that is associated
        with a registered standard and standardversion.
        Default: &_cstSASRefs global macro variable value
_cstLogLevel - - required - The level of error reporting.
        Values: info | warning | error | fatal error
        Default: info
_cstCallingPgm - - optional - The name of the driver module calling
        this macro.
File: cstutilxmlvalidate.sas
First available in version: 1.6

%cstvalidate(_cstCallingPgm=Unspecified, _cstReportOverride=N);

[ Exposure: external ]
Validates SAS Clinical Standards Toolkit metadata.

This macro iterates through the validation checks to be run and writes
validation results to the process Results data set. The results are then
persisted to any permanent location based on type=results records in
SASReferences.

Process cleanup is based on the _cstDebug global macro variable.

Required file inputs:
run-time (type=control,subtype=validation in sasreferences) check data set

Expected Macro Variables:
_cstCTDescription - Description of controlled terminology packet
_cstCheckSortOrder - Order in which validation checks are run
_cstDeBug - Turns debugging on or off for the session
_cstGRoot - Root path of the global standards library
_cstMessages - Cross-standard work messages data set
_cstResultsDS - Results data set
_cstSASRefs - Run-time SASReferences data set derived in process setup
_cstSRoot - Root path of the sample library
_cstSeqCnt - Results: Sequence number within _cstResultSeq
_cstStudyRootPath - Physical path location of the study
_cstVersion - Version of the SAS Clinical Standards Toolkit
_cst_MsgID - Results: Result or validation check ID
_cst_MsgParm1 - Messages: Parameter 1
_cst_MsgParm2 - Messages: Parameter 2
_cst_rc - Task error status
_cst_rcmsg - Message associated with _cst_rc
Parameters:
_cstCallingPgm - - optional - The name of the driver module calling
        this macro.
_cstReportOverride - - optional - Override the process reporting summary
        (in the call to %cstutilvalidationsummary) to NOT include the
        summary (Y).
        Values: N | Y
        Default: N
File: cstvalidate.sas
First available in version: 1.5