Importing XML Documents |
This example imports the XML document that is shown in Sample XML 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= options.
The following SAS program imports the XML document as a SAS data set:
filename odm 'C:\Documents and Settings\myid\MyDocuments\CDISC\AE.XML'; 1 libname odm xml xmltype=CDISCODM 2 FormatActive=YES 3 FormatNoReplace=NO 4 FormatLibrary="Work" 5 ; proc print data=odm.AE; 6 run;
The FILENAME statement assigns the fileref ODM to the physical location of the XML document (complete pathname, filename, and file extension).
The LIBNAME statement uses the fileref to reference the XML document and specifies the XML engine. 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.
FORMATACTIVE=YES specifies to convert CDISC ODM CodeList elements in the document to SAS formats.
FORMATNOREPLACE=NO specifies to replace any existing SAS formats in the format catalog that have the same name as the converted formats.
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.
The PRINT procedure produces the output.
The SAS System 1 Obs __STUDYOID __METADATAVERSIONOID __SUBJECTKEY __STUDYEVENTOID 1 STUDY.StudyOID v1.1.0 001 SE.VISIT1 2 STUDY.StudyOID v1.1.0 001 SE.VISIT1 Obs __STUDYEVENTREPEATKEY __FORMOID __FORMREPEATKEY __ITEMGROUPOID 1 1 FORM.AE 1 IG.AE 2 1 FORM.AE 1 IG.AE Obs __ITEMGROUPREPEATKEY TAREA PNO SCTRY 1 1 Oncology 143-02 United States 2 2 Oncology 143-02 United States Obs F_STATUS LINE_NO AETERM AESTMON AESTDAY 1 Source verified, queried 1 HEADACHE 6 10 2 Source verified, queried 2 CONGESTION 6 11 Obs AESTYR AESTDT AEENMON AEENDAY AEENYR AEENDT AESEV AEREL 1 1999 10JUN99 6 14 1999 14JUN99 Mild None 2 1999 11JUN99 . . . . Mild None Obs AEOUT AEACTTRT AECONTRT 1 Resolved, no residual effects None Medication required 2 Continuing None Medication required
The output from PROC CONTENTS 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.
proc contents data=odm.AE varnum; run;
PROC CONTENTS Output for ODM.AE
The SAS System 2 The CONTENTS Procedure Data Set Name ODM.AE Observations . Member Type DATA Variables 28 Engine XML Indexes 0 Created . Observation Length 0 Last Modified . Deleted Observations 0 Protection Compressed NO Data Set Type Sorted NO Label Data Representation Default Encoding Default Variables in Creation Order # Variable Type Len Format Informat Label 1 __STUDYOID Char 100 __STUDYOID 2 __ Char 100 __METADATAVERSIONOID METADATAVERSIONOID 3 __SUBJECTKEY Char 100 __SUBJECTKEY 4 __STUDYEVENTOID Char 100 __STUDYEVENTOID 5 __ Char 100 __STUDYEVENTREPEATKEY STUDYEVENTREPEATKE Y 6 __FORMOID Char 100 __FORMOID 7 __FORMREPEATKEY Char 100 __FORMREPEATKEY 8 __ITEMGROUPOID Char 100 __ITEMGROUPOID 9 __ Char 100 __ITEMGROUPREPEATKEY ITEMGROUPREPEATKEY 10 TAREA Char 4 $TAREAF. Therapeutic Area 11 PNO Char 15 Protocol Number 12 SCTRY Char 4 $SCTRYF. Country 13 F_STATUS Char 1 $F_STATU. Record status, 5 levels, internal use 14 LINE_NO Num 8 2. Line Number 15 AETERM Char 100 Conmed Indication 16 AESTMON Num 8 2. Start Month - Enter Two Digits 01-12 17 AESTDAY Num 8 2. Start Day - Enter Two Digits 01-31 18 AESTYR Num 8 4. Start Year - Enter Four Digit Year 19 AESTDT Num 8 DATE. Derived Start Date 20 AEENMON Num 8 2. Stop Month - Enter Two Digits 01-12 21 AEENDAY Num 8 2. Stop Day - Enter Two Digits 01-31 22 AEENYR Num 8 4. Stop Year - Enter Four Digit Year 23 AEENDT Num 8 DATE. Derived Stop Date 24 AESEV Char 1 $AESEV. Severity 25 AEREL Char 1 $AEREL. Relationship to study drug 26 AEOUT Char 1 $AEOUT. Outcome 27 AEACTTRT Char 1 $AEACTTR. Actions taken re study drug 28 AECONTRT Char 1 $AECONTR. Actions taken, other
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.