Special Topic: A Round Trip Exercise Involving the CDISC CRT-DDS Standard: Importing and Exporting the define.xml File

Overview

In general, when representing an XML-based standard in SAS, an XML element is mapped to a SAS data set and its associated attributes are mapped to the columns of the SAS data set. When the SAS Clinical Standards Toolkit creates a CDISC CRT-DDS 1.0 XML file, it converts the information from a SAS data set representation of the CRT-DDS model into XML. For CDISC CRT-DDS 1.0, this means that 39 data sets (such as ItemDefs) containing 176 columns are the source for creating the define.xml element and attribute structure. The SAS representation of the CRT-DDS standard can be derived in part from other standards (such as CDISC SDTM) and can include supporting metadata from other sources.
The first step in creating a define.xml file with the SAS Clinical Standards Toolkit is populating the SAS data set representation of the CRT-DDS model from the SDTM domain metadata (source_tables and source_columns data sets) and the study metadata (source_study data set) by running the crtdds_sdtmtodefine macro. Depending on the completeness of this source data, the crtdds_sdtmtodefine macro can (partially) populate these 12 of the 39 CRT-DDS SAS tables:
clitemdecodetranslatedtext
itemgroupdefitemrefs
codelistitems
itemgroupdefs
codelists
itemgroupleaf
computationmethods
itemgroupleaftitles
definedocument
metadataversion
itemdefs
study
The remainder of the tables will not be automatically populated by the SAS Clinical Standards Toolkit.
To create a CRT-DDS define.xml file that can be considered more complete, these tables typically need be populated by a process not included in the SAS Clinical Standards Toolkit:
  • annotatedcrfs (contains document references to the annotated case report form)
  • supplementaldocs (contains document references to the supplemental documentation)
  • mdvleaf (contains the href link for each of the documents listed in the AnnotatedCRF and SupplementalDocs tables)
  • mdvleaftitles (contains a descriptive title for each MDVLeaf item)
  • itemvaluelistrefs (associates each value list item to a row in the ItemDefs table)
  • valuelists (contains the ID of value lists)
  • valuelistitemrefs (contains the ID of each item in a value list)
  • externalcodelists (contains name and versions of external code lists)
The SAS Clinical Standards Toolkit provides a sample program to demonstrate that it supports importing and exporting of CRT-DDS metadata beyond the metadata that can be created from the SDTM domain metadata (source_tables and source_columns data sets) and the study metadata (source_study data set).

Sample Driver Program: import_sascrtdds_fromxml_export_toxml.sas

Overview

The SAS Clinical Standards Toolkit provides a driver program, import_sascrtdds_fromxml_export_toxml.sas, to demonstrate import and export of extensive CRT-DDS metadata.
This program is located in:
!sasroot/../../SASClinicalStandardsToolkitCRTDDS10/1.4/sample/cdisc-crtdds-1.0/programs
This program provides the same process setup function supported in most SAS Clinical Standards Toolkit driver modules, using a SASReferences data set that defines process inputs and outputs, and allocating all SAS librefs and filerefs. In this sample driver program, the SASReferences data sets are not created in the program, but rather read from a permanent SAS data set.
Here is the general workflow of this sample driver program:
  1. Call the cstutil_processsetup macro to set process paths and perform required library and file allocations.
    The cstutil_processsetup macro is called with these parameters:
    • _cstSASReferencesLocation=&studyRootPath/control
    • _cstSASReferencesName=import_sasreferences
  2. Call the crtdds_xmlvalidate macro to validate the CRT-DDS file (define_import.xml) to be imported.
  3. Call the crtdds_read macro to import the CRT-DDS file (define_import.xml) that was validated in step 2 to the CRT-DDS SAS data sets in the WORK library.
  4. Call the cstutil_processsetup macro to set process paths and perform required library and file allocations.
    The cstutil_processsetup macro is called with these parameters:
    • _cstSASReferencesLocation=&studyRootPath/control
    • _cstSASReferencesName=export_sasreferences
  5. Call the crtdds_write macro to export the CRT-DDS SAS data sets in the WORK library to the CRT-DDS file (define_export.xml).
  6. Call the crtdds_xmlvalidate macro to validate the CRT-DDS file (define_export.xml) that was exported in step 5.
The CRT-DDS file define_export.xml will be identical to the CRT-DDS file define_import.xml, apart from a time stamp.

The SASReferences Data Set

As a part of each SAS Clinical Standards Toolkit process setup, a valid SASReferences data set is required. It references the input files that are needed, the librefs and filenames to use, and the names and locations of data sets to be created by the process. It can be modified to point to study-specific files. For an explanation of the SASReferences data set, see SASReferences File.
The driver program initiates the macro variable &workpath with this SAS code:
%let workPath=%sysfunc(pathname(work));
Key Components of the SASReferences Data Set import_sasreference and Key Components of the SASReferences Data Set export_sasreferences list the files and data sets that are key components in the SASReference files that are used in the sample driver program import_sascrtdds_fromxml_export_toxml.sas. In this driver program, these values are set for &studyRootPath and &studyOutputPath:
&studyRootPath=!sasroot/../../SASClinicalStandardsToolkitCRTDDS10/&_cstVersion/sample/cdisc-crtdds-1.0
&studyOutputPath=!sasroot/../../SASClinicalStandardsToolkitCRTDDS10/&_cstVersion/sample/cdisc-crtdds-1.0
Key Components of the SASReferences Data Set import_sasreference
Input or Output
Metadata Type
SAS LIBNAME of Fileref to Use
Reference Type
Path
Name of File
Input
externalxml
crtxml
fileref
&studyRootPath/sourcexml
define_import.xml
Input
referencexml
crtmap
fileref
&studyRootPath/referencexml
define.map
Output
sourcedata
srcdata
libref
&workpath
*.*
Output
sourcemetadata
srcmeta
libref
&workpath
source_tables.sas7bdat
Output
sourcemetadata
srcmeta
libref
&workpath
source_columns.sas7bdat
Output
sourcemetadata
srcmeta
libref
&workpath
souce_study
Output
results
results
libref
&studyOutputPath/results
import_results.sas7bdat
Key Components of the SASReferences Data Set export_sasreferences
Input or Output
Metadata Type
SAS LIBNAME of Fileref to Use
Reference Type
Path
Name of File
Output
externalxml
crtxml
fileref
&studyRootPath/sourcexml
define_export.xml
Output
referencexml
xslt01
fileref
&studyRootPath/referencexml
Input
sourcedata
srcdata
libref
&workpath
*.*
Output
results
results
libref
&studyOutputPath/results
export_results.sas7bdat

Process Outputs

When running the sample driver program interactively, you can verify in the Work library the SAS representation of the CRT-DDS model contains observations for these CRT-DDS data sets.
clitemdecodetranslatedtext
metadataversion
codelistitems
study
codelists
annotatedcrfs
computationmethods
supplementaldocs
definedocument
mdvleaf
itemdefs
mdvleaftitles
itemgroupdefitemrefs
itemvaluelistrefs
itemgroupdefs
valuelists
itemgroupleaf
valuelistitemrefs
itemgroupleaftitles
externalcodelists
This example shows how the XML code from the CRT-DDS file define_import.xml has been imported in to four SAS CRT-DDS data sets (itemdefs, valuelists, valuelistitemrefs, and itemvaluelistrefs) in the Work library:
  <def:ValueListDef OID="ValueList.SC.SCTESTCD">
     <ItemRef ItemOID="SC.SCTESTCD.EDLEVEL" OrderNumber="19" Mandatory="No"/>
     <ItemRef ItemOID="SC.SCTESTCD.MARISTAT" OrderNumber="20" Mandatory="No"/>
     <ItemRef ItemOID="SC.SCTESTCD.SUBJINIT" OrderNumber="21" Mandatory="No"/>
  </def:ValueListDef>
  <ItemDef OID="SC.SCTESTCD" Name="SCTESTCD" DataType="text" Length="8"
           Origin="Assigned" def:Label="Subject Characteristic Short Name">
     <def:ValueListRef ValueListOID="ValueList.SC.SCTESTCD"/>
  </ItemDef>
  <ItemDef OID="SC.SCTESTCD.EDLEVEL" Name="EDLEVEL" DataType="text" 
           Length="24" Origin="CRF Page 6" def:Label="Education Level"/>
  <ItemDef OID="SC.SCTESTCD.MARISTAT" Name="MARISTAT" DataType="text"
           Length="8"  Origin="CRF Page 6" def:Label="Marital Status"/>
  <ItemDef OID="SC.SCTESTCD.SUBJINIT" Name="SUBJINIT" DataType="text"
           Length="3"  Origin="CRF Page 3" def:Label="Subject Initials"/>
SAS CRT-DDS Data Sets Imported from define_import.xml
SAS CRT-DDS data sets imported from define_import.xml