Importing an XML Document Using the GENERIC Markup Type

This example imports the following XML document, which conforms to the physical structure for the GENERIC markup type. For information about the required physical structure, see Understanding the Required Physical Structure for an XML Document to Be Imported Using the GENERIC Markup Type.
<?xml version="1.0" encoding="windows-1252" ?>
<TABLE>
   <CLASS>
      <Name> Alfred </Name>
      <Gender> M </Gender>
      <Age> 14 </Age>
      <Height> 69 </Height>
      <Weight> 112.5 </Weight>
   </CLASS>
   <CLASS>
      <Name> Alice </Name>
      <Gender> F </Gender>
      <Age> 13 </Age>
      <Height> 56.5 </Height>
      <Weight> 84 </Weight>
   </CLASS>
.
.
.
   <CLASS>
      <Name> William </Name>
      <Gender> M </Gender>
      <Age> 15 </Age>
      <Height> 66.5 </Height>
      <Weight> 112 </Weight>
   </CLASS>
</TABLE>
The following SAS program translates the XML markup to SAS proprietary format:
libname trans xml 'XML-document'; 1

libname myfiles 'SAS-library'; 2

data myfiles.class; 3
   set trans.class;
run;
1 The first LIBNAME statement assigns the libref TRANS to the physical location of the XML document (complete pathname, filename, and file extension) and specifies the XML engine. By default, the XML engine expects GENERIC markup.
2 The second LIBNAME statement assigns the libref MYFILES to the physical location of the SAS library that will store the resulting SAS data set. The V9 engine is the default.
3 The DATA step reads the XML document and writes its content in SAS proprietary format.
Issuing the following PRINT procedure produces the output for the data set that was translated from the XML document:
proc print data=myfiles.class;
run;
PRINT Procedure Output for MYFILES.CLASS
PRINT Procedure Output for MYFILES.CLASS