Sample 47349: Create and use an XMLMap file in a SAS® session
The automapping feature of the SAS XML Mapper that dynamically creates an XMLMap file from an XML file is now available in the second maintenance release of SAS® 9.3 (TS1M2) using the XMLV2 LIBNAME engine. The XMLMap file describes to the XMLV2 LIBNAME engine how to interpret XML markup into data sets, variables, and observations. This new enhancement provides the ability to create and use an XMLMap file in a single step to create a SAS data set from a hierarchical XML file.
To create and use an XMLMap file within the SAS session using the XMLV2 engine, specify the XMLMAP= option with the desired location of the map file, along with the AUTOMAP= option. The AUTOMAP= option accepts the arguments REPLACE or REUSE. When REPLACE is specified as an argument, the map file is overwritten if it already exists. If the REUSE argument is specified, the map file is reused rather than re-created if it already exists. Using either argument creates the map file if it does not exist.
In order to use this feature, both the XML file and the XMLMap file must reside on disk.
The sample code on the Full Code tab illustrates this new feature.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The sample code below uses the XMLV2 LIBNAME engine to dynamically create an XMLMap file.
/* Create sample XML file to read in the next step */
libname testfile xmlv2 'c:\temp\temp.xml';
proc copy in=sashelp out=testfile;
select class;
run;
/* Create the XMLMap file in temporary area and use this map to read data*/
filename mapfile 'c:\temp\test.map';
filename testfile 'c:\temp\temp.xml';
libname testfile xmlv2 xmlmap=mapfile automap=replace;
proc copy in=testfile out=work;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to create and use an XMLMap file from a SAS® session.
Date Modified: | 2012-10-02 09:44:06 |
Date Created: | 2012-08-29 06:01:40 |
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.3_M2 | | 9.3 TS1M2 | |
Z64 | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft® Windows® for x64 | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Standard Edition | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2003 for x64 | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2008 | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows Server 2008 for x64 | 9.3_M2 | | 9.3 TS1M2 | |
Microsoft Windows XP Professional | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Enterprise 32 bit | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Enterprise x64 | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Home Premium 32 bit | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Home Premium x64 | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Professional 32 bit | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Professional x64 | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Ultimate 32 bit | 9.3_M2 | | 9.3 TS1M2 | |
Windows 7 Ultimate x64 | 9.3_M2 | | 9.3 TS1M2 | |
Windows Vista | 9.3_M2 | | 9.3 TS1M2 | |
Windows Vista for x64 | 9.3_M2 | | 9.3 TS1M2 | |
64-bit Enabled AIX | 9.3_M2 | | 9.3 TS1M2 | |
64-bit Enabled HP-UX | 9.3_M2 | | 9.3 TS1M2 | |
64-bit Enabled Solaris | 9.3_M2 | | 9.3 TS1M2 | |
HP-UX IPF | 9.3_M2 | | 9.3 TS1M2 | |
Linux | 9.3_M2 | | 9.3 TS1M2 | |
Linux for x64 | 9.3_M2 | | 9.3 TS1M2 | |
Solaris for x64 | 9.3_M2 | | 9.3 TS1M2 | |