[an error occurred while processing this directive]

SAS Global Forum 2010


Paper 030-2010
Using XML Mapper and Enterprise Guide to Read Data and Metadata from an XML File

Larry Hoyle


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.

A zip file containing Sample data and code can be found heree


The Zip file contains:

  • 030-2010ExtraMaterial.txt - Index of 030-2010ExtraMaterial.zip
  • 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

Powerpoint Slides


Please send any questions about this page to Larry Hoyle at: LarryHoyle@ku.edu

[an error occurred while processing this directive]