Importing a CDISC ODM XML Document Using Default KeySet Processing

Overview

This example imports clinical trials data from a CDISC ODM XML document that is named AE.XML, and creates a SAS data set that is named RESULTS.AE.
The example illustrates the default behavior for KeySet members written to the output SAS data set. All KeySet members that are in the input XML document are converted to SAS variables and values in the output SAS data set.
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 fileref 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.
    • Fileref 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 name as the converted formats.
  4. ODMMINIMUMKEYSET=NO in the ODM statement specifies that all KeySet members are written to the output SAS data set. This is the default setting for ODMMINIMUMKEYSET=.
  5. The CLINICALDATA statement identifies the output SAS data set, which is RESULTS.AE, and specifies the CDISC ODM ItemGroupDef attribute that indicates where the data content in the XML document begins, which is AE.
  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=no; 4 
   clinicaldata out=results.AE sasdatasetname="AE"; 5
run;

proc contents data=results.AE varnum; 6 
run;

filename xmlinp clear;

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=NO, all KeySet members are written to the output SAS data set. These are the first 10 variables listed in the output. (The first two characters in resulting SAS variable names are two underscores.)
The maximum OID length, which is 100, is allocated to each KeySet member.
PROC CONTENTS Output for RESULTS.AE
PROC CONTENTS output for RESULTS.AE