Importing a CDISC ODM Document

This example imports the XML document that is shown in Example CDISC ODM Document. The document conforms to Version 1.2 of the CDISC Operational Data Model (ODM). To import a CDISC ODM document, you specify CDISCODM as the XML markup type, and you can specify values for the FORMATACTIVE= option, FORMATLIBRARY= option, and FORMATNOREPLACE= option.
The following SAS program imports the XML document as a SAS data set:
filename odm 'C:\Documents and Settings\myid\My Documents\CDISC\AE.XML'; 1

libname odm xml xmltype=CDISCODM 2 FormatActive=YES 3
   FormatNoReplace=NO 4 FormatLibrary="Work"; 5

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

1 The FILENAME statement assigns the fileref ODM to the physical location of the XML document (complete pathname, filename, and file extension).
2 The LIBNAME statement uses the fileref ODM to reference the XML document and specifies the XML engine. If the fileref matches the libref, you do not need to specify the physical location of the XML document in the LIBNAME statement. By default, the XML engine expects GENERIC markup, so you must include the XMLTYPE= option in order to read the XML document in CDISCODM markup.
3 FORMATACTIVE=YES specifies to convert CDISC ODM CodeList elements in the document to SAS formats.
4 FORMATNOREPLACE=NO specifies to replace any existing SAS formats in the format catalog that have the same name as the converted formats.
5 FORMATACTIVE="Work" specifies to create the format catalog in the temporary Work library. The Work library is also the default if you omit the FORMATACTIVE= option.
6 The output from the CONTENTS procedure displays the file's attributes as well as the attributes of each interpreted column (variable), such as the variable's type and length. The attributes are obtained from the embedded ODM metadata content. The VARNUM option causes the variables to be printed first in alphabetical order and then in the order of their creation.
CONTENTS Procedure Output for ODM.AE
CONTENTS Procedure Output for ODM.AE