Using XML Mapper and Enterprise Guide to Read Data and Metadata from an XML File
Increasingly, data and metadata are archived together in XML files. This tutorial works through the process of reading an XML file containing a data table, variable labels, notes about variables, and multiple sets of labels for values – some of which are not associated with any variable. First, we will use the XML Mapper with the archetypical XML file to create an XMLMAP file. We will then create an Enterprise Guide project to organize the sequence of operations that follow. The SAS XMLMAP facility of the XML engine uses the XMLMAP file to read the complex, hierarchical, XML file into a set of related tables. Additional SAS code transforms the initial data table from one row per value to a table with multiple variables and one row per observation. Other code labels the dataset, applies variable labels, creates a CNTLIN dataset, creates formats from the CNTLIN dataset, and associates formats with variables. The finished Enterprise Guide project could then be used to read any XML file having the same structure (Schema) as the original file.
View the pdf for.
You can also see the PowerPoint Presentation file.
Extra material from this paper can be found in the zip file 030-2010ExtraMaterial.zip.
The zip file contains
MyXMLintoSASparameterized.egp - SAS Enterprise Guide Project
MyXMLintoSASparameterized.sas - all SAS code exported from MyXMLintoSASparameterized.egp
SGF_030_2010_ReadXML.sas - SAS code written by XML Mapper
SGF_030_2010_XMLmap.map - XML Map file written by XML Mapper
SGF_030_2010_XMLmapUpdated.map - XML Map file to read SUGI_SGF4.xml with corrections for lengths
SUGI_SGF4.xml - XML data file
Submitted by Larry Hoyle. Contact me at my Discussion Page.