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 19 of the 39 CRT-DDS SAS tables:
definedocument
codelists
study
codelistitems
metadataversion
valuelists
computationmethods
valuelistitemrefs
clitemdecodetranslatedtext
itemvaluelistrefs
itemdefs
annotatedcrfs
itemgroupdefitemrefs
supplementaldocs
itemgroupdefs
mdvleaf
itemgroupleaf
mdvleaftitles
itemgroupleaftitles
The externalcodelists table will not be automatically populated by the SAS Clinical Standards Toolkit. The remaining tables are typically not used for a define.xml in the context of an electronic data submission.

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:
sample study library directory/cdisc-crtdds-1.0–1.5/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 for the import_sasreference Macro and Key Components of the SASReferences Data Set for the export_sasreferences Macro 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=sample study library directory/cdisc-crtdds-1.0–1.5
&studyOutputPath=sample study library directory/cdisc-crtdds-1.0–1.5
Key Components of the SASReferences Data Set for the import_sasreference Macro
Metadata Type
SAS LIBNAME or Fileref to Use
Reference Type
Path
Name of File
Input
externalxml
crtxml
fileref
&studyRootPath/sourcexml
define_import.xml
referencexml
crtmap
fileref
&studyRootPath/referencexml
define.map
Output
sourcedata
srcdata
libref
&workpath
*.*
sourcemetadata
srcmeta
libref
&workpath
source_tables.sas7bdat
sourcemetadata
srcmeta
libref
&workpath
source_columns.sas7bdat
sourcemetadata
srcmeta
libref
&workpath
souce_study
results
results
libref
&studyOutputPath/results
import_results.sas7bdat
Key Components of the SASReferences Data Set for the export_sasreferences Macro
Metadata Type
SAS LIBNAME or Fileref to Use
Reference Type
Path
Name of File
Input
sourcedata
srcdata
libref
&workpath
*.*
Output
externalxml
crtxml
fileref
&studyRootPath/sourcexml
define_export.xml
referencexml
xslt01
fileref
&studyRootPath/referencexml
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
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