Exporting a CDISC ODM XML Document with Metadata Attributes in Statement Syntax

Overview

This example, which includes only the required PROC CDISC statements for exporting, specifies the metadata attributes in the statements.
As an alternative, you can store metadata attributes for the required ODM, STUDY, GLOBALVARIABLES, and METADATAVERSION statements in separate SAS data sets that you reference with the DATA= argument. For an example, see Exporting a CDISC ODM XML Document with Metadata Attributes in SAS Data Sets.

Program

The following SAS program exports a SAS data set as a CDISC ODM XML document:
  1. The LIBNAME statement assigns the libref RESULTS to the physical location of the input SAS data set.
  2. The FILENAME statement assigns the fileref XMLOUT to the physical location of the output XML document (complete pathname, filename, and file extension) to be exported.
  3. The SORT procedure specifies to sort the input SAS data set by the __SUBJECTKEY variable.
  4. The PROC CDISC statement specifies the following:
    • CDISC ODM as the model.
    • Fileref XMLOUT, which references the physical location of the output XML document to be exported.
    • FORMATACTIVE=YES to convert CDISC ODM CodeList content in the XML document to SAS formats.
    • FORMATNOREPLACE=NO to replace existing SAS formats in the FORMAT catalog that have the same name as the converted formats.
  5. The ODM statement specifies the required metadata attributes for exporting, such as the CDISC ODM version and file type.
  6. The STUDY statement specifies the study identifier.
  7. Options in the GLOBALVARIABLES statement specify general summary information about the study.
  8. The METADATAVERSION statement specifies the required metadata version and version name.
  9. The CLINICALDATA statement identifies the input SAS data set, which is RESULTS.AE. The input SAS data set contains the data content and KeySet members that are written to the XML document. In addition, the CLINICALDATA statement specifies optional metadata attributes.
libname results 'C:\My Documents\'; 1

filename  xmlout  'C:\XML\AEfull.XML'; 2

proc sort data=results.AE; 3
   by __subjectkey;
run:

proc cdisc model=odm 4
                  write=xmlout
                  formatactive=yes
                  formatnoreplace=no;

   odm odmversion="1.2" 5
                  fileoid="000-00-0000"
                  filetype=SNAPSHOT
                  description="Adverse events from the CTChicago file";

   study studyoid="STUDY.StudyOID"; 6

   globalvariables studyname="CDISC Connect-A-Thon Test Study III" 7      
                  studydescription="This file contains test data for the CDISC 
                                    Connect-A-Thon event scheduled for the DIA
                                    38th annual meeting in Chicago."
                  protocolname="CDISC-Protocol-00-000";

   metadataversion metadataversionoid="v1.1.0" 8
                  name="Version 1.1.0";

   clinicaldata data=results.AE 9
                  domain="AE"
                  name="Adverse Events" 
                  comment="All adverse events in this trial" ;
run;

filename xmlout clear;

libname results clear;

Output

The following is an annotated excerpt of the output CDISC ODM XML document:
  1. All of the metadata is contained by a single MetaDataVersion element.
  2. A Protocol element that contains a StudyEventRef for each StudyEventDef is automatically generated.
  3. A StudyEventDef element that contains a FormRef for each FormDef is automatically generated.
  4. A FormDef element that contains an ItemGroupRef for each ItemGroupDef is automatically generated.
  5. The SAS data set is represented as an ItemGroupDef.
  6. Each variable in the SAS data set is represented as an ItemRef.
  7. If a variable contains a reference to a user-defined SAS format, a CodeListRef is generated in the ItemDef for the variable.
  8. A CodeList element is generated for each unique user-defined SAS format that is referenced.
  9. A ClinicalData element is created for each ItemGroupDef that is referenced.
CDISC ODM XML Document Exported by PROC CDISC
<?xml version="1.0" encoding="windows-1252" ?>
<!--
      Clinical Data Interchange Standards Consortium (CDISC)
      Operational Data Model (ODM) for clinical data interchange

      You can learn more about CDISC standards efforts at 
      http://www.cdisc.org/standards/index.html
  -->

<ODM xmlns="http://www.cdisc.org/ns/odm/v1.2"
     xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.cdisc.org/ns/odm/v1.2 ODM1-2-0.xsd"

     ODMVersion="1.2"
     FileOID="000-00-0000"
     FileType="Snapshot"
     Description="Adverse events from the CTChicago file"

     AsOfDateTime="2010-09-30T14:07:31"
     CreationDateTime="2010-09-30T14:07:31"
     SourceSystem="SAS 9.3 PROC CDISC"
     SourceSystemVersion="9.03.01B0D09292010 3.00.65">

<Study OID="STUDY.StudyOID">

<!--
      GlobalVariables is a REQUIRED section in ODM markup
  -->
<GlobalVariables>
<StudyName>CDISC Connect-A-Thon Test Study III</StudyName>
<StudyDescription>This file contains test data for the CDISC Connect-A-Thon event 
scheduled for the DIA 38th annual meeting in Chicago.</StudyDescription>
<ProtocolName>CDISC-Protocol-00-000</ProtocolName>
</GlobalVariables>

<BasicDefinitions />

<!--
      Internal ODM markup required metadata
  -->
<MetaDataVersion OID="v1.1.0" Name="Version 1.1.0"> 1
<Protocol> 2
<StudyEventRef StudyEventOID="SE.VISIT1" OrderNumber="1" Mandatory="Yes" />
</Protocol>

<StudyEventDef OID="SE.VISIT1" Name="Study Event Definition" Repeating="Yes" Type="Common"> 3
<FormRef FormOID="FORM.AE" OrderNumber="1" Mandatory="No" />
</StudyEventDef>

<FormDef OID="FORM.AE" Name="Form Definition" Repeating="Yes"> 4
<ItemGroupRef ItemGroupOID="IG.AE" Mandatory="No" />
</FormDef>


<!--
      Columns defined in the table
  -->
<ItemGroupDef OID="IG.AE" Repeating="Yes" 5
              SASDatasetName="AE"
              Name="Adverse Events"
              Domain="AE"
              Comment="All adverse events in this trial">
<ItemRef ItemOID="ID.TAREA" OrderNumber="1" Mandatory="No" /> 6
<ItemRef ItemOID="ID.PNO" OrderNumber="2" Mandatory="No" />
<ItemRef ItemOID="ID.SCTRY" OrderNumber="3" Mandatory="No" />
<ItemRef ItemOID="ID.F_STATUS" OrderNumber="4" Mandatory="No" />
<ItemRef ItemOID="ID.LINE_NO" OrderNumber="5" Mandatory="No" />
<ItemRef ItemOID="ID.AETERM" OrderNumber="6" Mandatory="No" />
<ItemRef ItemOID="ID.AESTMON" OrderNumber="7" Mandatory="No" />
<ItemRef ItemOID="ID.AESTDAY" OrderNumber="8" Mandatory="No" />
<ItemRef ItemOID="ID.AESTYR" OrderNumber="9" Mandatory="No" />
<ItemRef ItemOID="ID.AESTDT" OrderNumber="10" Mandatory="No" />
<ItemRef ItemOID="ID.AEENMON" OrderNumber="11" Mandatory="No" />
<ItemRef ItemOID="ID.AEENDAY" OrderNumber="12" Mandatory="No" />
<ItemRef ItemOID="ID.AEENYR" OrderNumber="13" Mandatory="No" />
<ItemRef ItemOID="ID.AEENDT" OrderNumber="14" Mandatory="No" />
<ItemRef ItemOID="ID.AESEV" OrderNumber="15" Mandatory="No" />
<ItemRef ItemOID="ID.AEREL" OrderNumber="16" Mandatory="No" />
<ItemRef ItemOID="ID.AEOUT" OrderNumber="17" Mandatory="No" />
<ItemRef ItemOID="ID.AEACTTRT" OrderNumber="18" Mandatory="No" />
<ItemRef ItemOID="ID.AECONTRT" OrderNumber="19" Mandatory="No" />
</ItemGroupDef>


<!--
      Column attributes as defined in the table
  -->
<ItemDef OID="ID.TAREA" Name="TAREA" SASFieldName="TAREA" DataType="text" Length="4">
<CodeListRef CodeListOID="CL.$TAREAF" /> 7
</ItemDef>
<ItemDef OID="ID.PNO" Name="PNO" SASFieldName="PNO" DataType="text" Length="15" />
<ItemDef OID="ID.SCTRY" Name="SCTRY" SASFieldName="SCTRY" DataType="text" Length="4">
<CodeListRef CodeListOID="CL.$SCTRYF" />
</ItemDef>
<ItemDef OID="ID.F_STATUS" Name="F_STATUS" SASFieldName="F_STATUS" DataType="text" Length="1">
<CodeListRef CodeListOID="CL.$F_STATU" />
</ItemDef>
<ItemDef OID="ID.LINE_NO" Name="LINE_NO" SASFieldName="LINE_NO" DataType="integer" Length="2" />
<ItemDef OID="ID.AETERM" Name="AETERM" SASFieldName="AETERM" DataType="text" Length="100" />
<ItemDef OID="ID.AESTMON" Name="AESTMON" SASFieldName="AESTMON" DataType="integer" Length="2" />
<ItemDef OID="ID.AESTDAY" Name="AESTDAY" SASFieldName="AESTDAY" DataType="integer" Length="2" />
<ItemDef OID="ID.AESTYR" Name="AESTYR" SASFieldName="AESTYR" DataType="integer" Length="4" />
<ItemDef OID="ID.AESTDT" Name="AESTDT" SASFieldName="AESTDT" DataType="date" />
<ItemDef OID="ID.AEENMON" Name="AEENMON" SASFieldName="AEENMON" DataType="integer" Length="2" />
<ItemDef OID="ID.AEENDAY" Name="AEENDAY" SASFieldName="AEENDAY" DataType="integer" Length="2" />
<ItemDef OID="ID.AEENYR" Name="AEENYR" SASFieldName="AEENYR" DataType="integer" Length="4" />
<ItemDef OID="ID.AEENDT" Name="AEENDT" SASFieldName="AEENDT" DataType="date" />
<ItemDef OID="ID.AESEV" Name="AESEV" SASFieldName="AESEV" DataType="text" Length="1">
<CodeListRef CodeListOID="CL.$AESEV" />
</ItemDef>
<ItemDef OID="ID.AEREL" Name="AEREL" SASFieldName="AEREL" DataType="text" Length="1">
<CodeListRef CodeListOID="CL.$AEREL" />
</ItemDef>
<ItemDef OID="ID.AEOUT" Name="AEOUT" SASFieldName="AEOUT" DataType="text" Length="1">
<CodeListRef CodeListOID="CL.$AEOUT" />
</ItemDef>
<ItemDef OID="ID.AEACTTRT" Name="AEACTTRT" SASFieldName="AEACTTRT" DataType="text" Length="1">
<CodeListRef CodeListOID="CL.$AEACTTR" />
</ItemDef>
<ItemDef OID="ID.AECONTRT" Name="AECONTRT" SASFieldName="AECONTRT" DataType="text" Length="1">
<CodeListRef CodeListOID="CL.$AECONTR" />
</ItemDef>


<!--
      Translation to ODM markup for any PROC FORMAT style
      user defined or SAS internal formatting specifications
      applied to columns in the table
  -->
<CodeList OID="CL.$TAREAF" SASFormatName="$TAREAF" Name="$TAREAF" DataType="text"> 8
<CodeListItem CodedValue='ONC'>
<Decode>
<TranslatedText>Oncology</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$SCTRYF" SASFormatName="$SCTRYF" Name="$SCTRYF" DataType="text">
<CodeListItem CodedValue='USA'>
<Decode>
<TranslatedText>United States</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$F_STATU" SASFormatName="$F_STATU" Name="$F_STATU" DataType="text">
<CodeListItem CodedValue='S'>
<Decode>
<TranslatedText>Source verified, not queried</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='V'>
<Decode>
<TranslatedText>Source verified, queried</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$AESEV" SASFormatName="$AESEV" Name="$AESEV" DataType="text">
<CodeListItem CodedValue='1'>
<Decode>
<TranslatedText>Mild</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='2'>
<Decode>
<TranslatedText>Moderate</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='3'>
<Decode>
<TranslatedText>Severe</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='4'>
<Decode>
<TranslatedText>Life Threatening</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$AEREL" SASFormatName="$AEREL" Name="$AEREL" DataType="text">
<CodeListItem CodedValue='0'>
<Decode>
<TranslatedText>None</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='1'>
<Decode>
<TranslatedText>Unlikely</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='2'>
<Decode>
<TranslatedText>Possible</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='3'>
<Decode>
<TranslatedText>Probable</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$AEOUT" SASFormatName="$AEOUT" Name="$AEOUT" DataType="text">
<CodeListItem CodedValue='1'>
<Decode>
<TranslatedText>Resolved, no residual effects</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='2'>
<Decode>
<TranslatedText>Continuing</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='3'>
<Decode>
<TranslatedText>Resolved, residual effects</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='4'>
<Decode>
<TranslatedText>Death</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$AEACTTR" SASFormatName="$AEACTTR" Name="$AEACTTR" DataType="text">
<CodeListItem CodedValue='0'>
<Decode>
<TranslatedText>None</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='1'>
<Decode>
<TranslatedText>Discontinued permanently</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='2'>
<Decode>
<TranslatedText>Reduced</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='3'>
<Decode>
<TranslatedText>Interrupted</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>

<CodeList OID="CL.$AECONTR" SASFormatName="$AECONTR" Name="$AECONTR" DataType="text">
<CodeListItem CodedValue='0'>
<Decode>
<TranslatedText>None</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='1'>
<Decode>
<TranslatedText>Medication required</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='2'>
<Decode>
<TranslatedText>Hospitalization required or prolonged</TranslatedText>
</Decode>
</CodeListItem>
<CodeListItem CodedValue='3'>
<Decode>
<TranslatedText>Other</TranslatedText>
</Decode>
</CodeListItem>
</CodeList>
</MetaDataVersion>
</Study>


<!--
      Administrative metadata
  -->
<AdminData />


<!--
      Actual data content begins here
      This section represents each data record in the table
  -->
<ClinicalData StudyOID="STUDY.StudyOID" MetaDataVersionOID="v1.1.0"> 9
<SubjectData SubjectKey="001">
<StudyEventData StudyEventOID="SE.VISIT1" StudyEventRepeatKey="1">
<FormData FormOID="FORM.AE" FormRepeatKey="1">
<ItemGroupData ItemGroupOID="IG.AE" ItemGroupRepeatKey="1">
<ItemData ItemOID="ID.TAREA" Value="ONC" />
<ItemData ItemOID="ID.PNO" Value="143-02" />
<ItemData ItemOID="ID.SCTRY" Value="USA" />
<ItemData ItemOID="ID.F_STATUS" Value="V" />
<ItemData ItemOID="ID.LINE_NO" Value="1" />
<ItemData ItemOID="ID.AETERM" Value="HEADACHE" />
<ItemData ItemOID="ID.AESTMON" Value="6" />
<ItemData ItemOID="ID.AESTDAY" Value="10" />
<ItemData ItemOID="ID.AESTYR" Value="1999" />
<ItemData ItemOID="ID.AESTDT" Value="1999-06-10" />
<ItemData ItemOID="ID.AEENMON" Value="6" />
<ItemData ItemOID="ID.AEENDAY" Value="14" />
<ItemData ItemOID="ID.AEENYR" Value="1999" />
<ItemData ItemOID="ID.AEENDT" Value="1999-06-14" />
<ItemData ItemOID="ID.AESEV" Value="1" />
<ItemData ItemOID="ID.AEREL" Value="0" />
<ItemData ItemOID="ID.AEOUT" Value="1" />
<ItemData ItemOID="ID.AEACTTRT" Value="0" />
<ItemData ItemOID="ID.AECONTRT" Value="1" />
</ItemGroupData>
<ItemGroupData ItemGroupOID="IG.AE" ItemGroupRepeatKey="2">
<ItemData ItemOID="ID.TAREA" Value="ONC" />
<ItemData ItemOID="ID.PNO" Value="143-02" />
<ItemData ItemOID="ID.SCTRY" Value="USA" />
<ItemData ItemOID="ID.F_STATUS" Value="V" />
<ItemData ItemOID="ID.LINE_NO" Value="2" />
<ItemData ItemOID="ID.AETERM" Value="CONGESTION" />
<ItemData ItemOID="ID.AESTMON" Value="6" />
<ItemData ItemOID="ID.AESTDAY" Value="11" />
<ItemData ItemOID="ID.AESTYR" Value="1999" />
<ItemData ItemOID="ID.AESTDT" Value="1999-06-11" />
<ItemData ItemOID="ID.AEENMON" IsNull="Yes" />
<ItemData ItemOID="ID.AEENDAY" IsNull="Yes" />
<ItemData ItemOID="ID.AEENYR" IsNull="Yes" />
<ItemData ItemOID="ID.AEENDT" IsNull="Yes" />
<ItemData ItemOID="ID.AESEV" Value="1" />
<ItemData ItemOID="ID.AEREL" Value="0" />
<ItemData ItemOID="ID.AEOUT" Value="2" />
<ItemData ItemOID="ID.AEACTTRT" Value="0" />
<ItemData ItemOID="ID.AECONTRT" Value="1" />
</ItemGroupData>
</FormData>
</StudyEventData>
</SubjectData>
</ClinicalData>
</ODM>