| 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 format type, and you optionally specify values for the FORMATACTIVE=, FORMATLIBRARY=, and FORMATNOREPLACE= options.
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';libname odm xml xmltype=CDISCODM
FormatActive=YES
FormatNoReplace=NO
FormatLibrary="Work"
; proc print data=odm.AE;
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 the GENERIC format, so you must include the XMLTYPE= option in order to read the XML document in CDISCODM format.
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
1 STUDY.StudyOID
2 STUDY.StudyOID
Obs __METADATAVERSIONOID
1 v1.1.0
2 v1.1.0
Obs __SUBJECTKEY
1 001
2 001
Obs __STUDYEVENTOID
1 SE.VISIT1
2 SE.VISIT1
Obs __STUDYEVENTREPEATKEY
1
2
Obs __FORMOID
1 FORM.AE
2 FORM.AE
Obs __FORMREPEATKEY
1
2
Obs __ITEMGROUPOID
1 IG.AE
2 IG.AE
The SAS System 2
Obs __ITEMGROUPREPEATKEY
1 1
2 2
Obs __TRANSACTIONTYPE TAREA PNO SCTRY F_STATUS LINE_NO
1 Oncology 143-02 United States Source verified, queried 1
2 Oncology 143-02 United States Source verified, queried 2
Obs AETERM
1 HEADACHE
2 CONGESTION
Obs AESTMON AESTDAY AESTYR AESTDT AEENMON AEENDAY AEENYR AEENDT AESEV AEREL
1 6 10 1999 1999-06-10 6 14 1999 1999-06-14 Mild None
2 6 11 1999 1999-06-11 . . . . 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 3
The CONTENTS Procedure
Data Set Name ODM.AE Observations .
Member Type DATA Variables 29
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 $100. $100. __STUDYOID
2 __METADATAVERSIONOID Char 100 $100. $100. __METADATAVERSIONOID
3 __SUBJECTKEY Char 100 $100. $100. __SUBJECTKEY
4 __STUDYEVENTOID Char 100 $100. $100. __STUDYEVENTOID
5 __STUDYEVENTREPEATKEY Char 100 $100. $100. __STUDYEVENTREPEATKEY
6 __FORMOID Char 100 $100. $100. __FORMOID
7 __FORMREPEATKEY Char 100 $100. $100. __FORMREPEATKEY
8 __ITEMGROUPOID Char 100 $100. $100. __ITEMGROUPOID
9 __ITEMGROUPREPEATKEY Char 100 $100. $100. __ITEMGROUPREPEATKEY
10 __TRANSACTIONTYPE Char 8 $8. $8. __TRANSACTIONTYPE
11 TAREA Char 4 $TAREAF. Therapeutic Area
12 PNO Char 15 $15. $15. Protocol Number
13 SCTRY Char 4 $SCTRYF. Country
14 F_STATUS Char 1 $F_STATU. Record status, 5 levels, internal use
15 LINE_NO Num 8 F8. F8. Line Number
16 AETERM Char 100 $100. $100. Conmed Indication
17 AESTMON Num 8 F8. F8. Start Month - Enter Two Digits 01-12
18 AESTDAY Num 8 F8. F8. Start Day - Enter Two Digits 01-31
19 AESTYR Num 8 F8. F8. Start Year - Enter Four Digit Year
20 AESTDT Num 8 IS8601DA10. IS8601DA10. Derived Start Date
21 AEENMON Num 8 F8. F8. Stop Month - Enter Two Digits 01-12
22 AEENDAY Num 8 F8. F8. Stop Day - Enter Two Digits 01-31
23 AEENYR Num 8 F8. F8. Stop Year - Enter Four Digit Year
24 AEENDT Num 8 IS8601DA10. IS8601DA10. Derived Stop Date
25 AESEV Char 1 $AESEV. Severity
26 AEREL Char 1 $AEREL. Relationship to study drug
27 AEOUT Char 1 $AEOUT. Outcome
28 AEACTTRT Char 1 $AEACTTR. Actions taken re study drug
29 AECONTRT Char 1 $AECONTR. Actions taken, other
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.