Exporting a CDISC ODM XML Document with Metadata Attributes in SAS Data Sets

Overview

This example, which includes only the required PROC CDISC statements for exporting, illustrates how to specify metadata attributes that are stored in SAS data sets and referenced in the DATA= argument. For information about the advantages of using this method, see Specifying CDISC ODM Metadata Attributes.
When exporting, you can specify metadata attributes for the required ODM, STUDY, GLOBALVARIABLES, and METADATAVERSION statements either directly in the CDISC procedure statement or stored in a SAS data set. However, the optional metadata attributes for the required CLINICALDATA statement must be specified as part of the CLINICALDATA statement syntax.

Program

First, create SAS data sets that contain metadata attributes. The LIBNAME statement assigns the libref CURRENT to the physical location of the SAS data sets that will store the metadata attributes.
libname current 'C:\mydata\';

data current.odm;
   odmversion="1.2";
   fileoid="ODM.FileOID";
   filetype="Snapshot";
   description="Optional descriptive information";
run;

data current.study;
   studyoid="OID.StudyOID";
run;

data current.globals;
   studyname="CDISC Test Study III";
   studydescription="This file contains test data for CDISC testing";
   protocolname="CDISC-Protocol-00-0000";
run;

data current.metadata;
    metadataversionoid="v1.1.0";
    name="Version 1.1.0";
run;
Then, reference the SAS data sets in a PROC CDISC program:
  1. The FILENAME statement assigns the fileref XMLOUT to the physical location of the output XML document.
  2. The required PROC CDISC statement specifies CDISC ODM as the model and the fileref XMLOUT, which references the physical location of the output XML document.
  3. The required ODM statement includes the DATA= argument to reference the SAS data set CURRENT.ODM, which stores the CDISC ODM version and file type.
  4. The required STUDY statement includes the DATA= argument to reference the SAS data set CURRENT.STUDY, which stores the study identifier.
  5. The required GLOBALVARIABLES statement includes the DATA= argument to reference the SAS data set CURRENT.GLOBALS, which stores general summary information about the study.
  6. The required METADATAVERSION statement includes the DATA= argument to reference the SAS data set CURRENT.METADATA, which stores the metadata version and version name.
  7. The required CLINICALDATA statement identifies the input SAS data set, which is CURRENT.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.
filename xmlout 'C:\XML\aeds.xml'; 1

proc cdisc model=odm write=xmlout; 2
   odm data=current.odm; 3
   study data=current.study; 4
   globalvariables data=current.globals; 5
   metadataversion data=current.metadata; 6
   clinicaldata data = current.ae 7
                domain="AE"
                name="Adverse Events"
                comment="All adverse events in this trial";
run;

filename xmlout clear;

Output

The following output shows the exported XML document:
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="ODM.FileOID"
     FileType="Snapshot"
     Description="Optional descriptive information"

     AsOfDateTime="2009-03-09T12:45:33"
     CreationDateTime="2009-03-09T12:45:33"
     SourceSystem="SAS 9.2 PROC CDISC"
     SourceSystemVersion="9.02.02M0D01222009 3.00.65">

   <Study OID="STUDY.StudyOID">

      <!--
            GlobalVariables is a REQUIRED section in ODM markup
        -->
      <GlobalVariables>
         <StudyName>CDISC Test Study III</StudyName>
         <StudyDescription>This file contains test data for CDISC
testing</StudyDescription>
         <ProtocolName>CDISC-Protocol-00-0000</ProtocolName>
      </GlobalVariables>

      <BasicDefinitions />

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

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

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


<!--
               Columns defined in the table
           -->
         <ItemGroupDef OID="IG.AE" Repeating="Yes"
                       SASDatasetName="AE"
                       Name="Adverse Events"
                       Domain="AE"
                       Comment="All adverse events in this trial">

            <ItemRef ItemOID="ID.TAREA" OrderNumber="1" Mandatory="No" />
            <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" />
         <ItemDef OID="ID.PNO" Name="PNO" SASFieldName="PNO" DataType="text"
Length="15" />
         <ItemDef OID="ID.SCTRY" Name="SCTRY" SASFieldName="SCTRY"
DataType="text" Length="4" />
         <ItemDef OID="ID.F_STATUS" Name="F_STATUS" SASFieldName="F_STATUS"
DataType="text" Length="1" />
         <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" />
         <ItemDef OID="ID.AEREL" Name="AEREL" SASFieldName="AEREL"
DataType="text" Length="1" />
         <ItemDef OID="ID.AEOUT" Name="AEOUT" SASFieldName="AEOUT"
DataType="text" Length="1" />
         <ItemDef OID="ID.AEACTTRT" Name="AEACTTRT" SASFieldName="AEACTTRT"
DataType="text" Length="1" />
         <ItemDef OID="ID.AECONTRT" Name="AECONTRT" SASFieldName="AECONTRT"
DataType="text" Length="1" />
      </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">
      <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>