Importing a CDISC ODM XML Document Specifying KeySet Processing Options

Overview

This example imports clinical trials data from a CDISC ODM XML document that is named AE.XML. It also creates a SAS data set that is named Results.AEMin.
The example illustrates the results of specifying the KeySet processing options ODMMINIMUMKEYSET=YES and ODMMAXIMUMOIDLENGTH= in the ODM statement. Only the unique SubjectKey member is written to the output SAS data set. The character length for the KeySet members is reduced from the default OID length.
To view the AE.XML document, see Sample CDISC ODM XML Document.

Program

The following SAS program imports the XML document as a SAS data set:
  1. The LIBNAME statement assigns the libref Results to the physical location of the output SAS data set.
  2. The FILENAME statement assigns the file reference Xmlinp to the physical location of the input XML document (complete pathname, filename, and file extension) to be imported.
  3. The PROC CDISC statement specifies the following:
    • CDISC ODM as the model.
    • File reference Xmlinp, which references the physical location of the input XML document to be imported.
    • 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 names as the converted formats.
  4. ODMMINIMUMKEYSET=YES in the ODM statement specifies that only the SubjectKey is written to the output SAS data set.
    ODMMAXIMUMOIDLENGTH=18 in the ODM statement allocates a storage space of 18 characters for the KeySet member character length, instead of the default maximum OID length.
  5. The CLINICALDATA statement identifies the output SAS data set (which is Results.AEMin) and specifies the CDISC ODM ItemGroupDef attribute that indicates where the data content in the XML document (which is AE) begins.
  6. The CONTENTS procedure lists the contents of the output SAS data set. The VARNUM option lists the variables in the order in which they were created.
libname Results 'C:\My Documents\'; 1 

filename Xmlinp 'C:\XML\AE.xml'; 2

proc cdisc model=odm 3
                  read=Xmlinp 
                  formatactive=yes
                  formatnoreplace=no;

   odm odmversion="1.2"
                  odmminimumkeyset=yes 4
                  odmmaximumoidlength=18;                


   clinicaldata out=Results.AEMin sasdatasetname="AE"; 5
run;

filename Xmlinp clear;

proc contents data=Results.AEMin varnum; 6
run;

libname Results clear;

Output

The output from PROC CONTENTS displays the attributes of each interpreted variable, such as the variable’s type and length. The attributes are obtained from the embedded metadata content.
Because ODMMINIMUMKEYSET=YES, only the SubjectKey is written to the output SAS data set, which is the first variable listed in the output.
Because ODMMAXIMUMOIDLENGTH=18, an OID length of 18 is allocated.
PROC CONTENTS Output for Results.AEMin
PROC CONTENTS output for Results.AEMin