DATA Step, Macro, Functions and more

read-in a XML-file

Reply
Occasional Contributor
Posts: 5

read-in a XML-file


Hello,

how can I readin this type of XML-File in SAS? How the xmlmap-file must look like?

<?xml version="1.0"?>

<table>

<row>

<column>ID</column>

<column>Spalte2</column>

<column>Spalte3</column>

<column>Spalte4</column>

<column>Spalte5</column>

<column>Spalte6</column>

<column>Spalte7</column>

<column>Spalte8</column>

</row>

<row>

<column>108362</column>

<column>gfdgfd</column>

<column>30161</column>

<column>hgdgfdf</column>

<column>gfdgfdfgd</column>

<column>Deutschland</column>

<column>gfdgfd</column>

<column></column>

</row>

<row>

<column>108363</column>

<column>weqwe</column>

<column>30162</column>

<column>qewq</column>

<column>qeqwe</column>

<column>Deutschland</column>

<column>ewqweq</column>

<column>ewqweq</column>

</row>

</table>

SAS Employee
Posts: 35

Re: read-in a XML-file

If you are running the second maintenance release of SAS 9.3 or later, you can use the AUTOMAP option of the XMLV2 Libname engine:

    LIBNAME X XMLV2 "<path to XML file>" AUTOMAP=REPLACE XMLMAP="<path to XML Mapper file created>";

You will need to supply your site specific information for the places I used angle brackets, < >. This will create 3 data sets. The one of interest will be the Columns data set.

If you are running a version of SAS that does not support the AUTOMAP option, you will need to use the XML Mapper application. It is a free download from the SAS Customer Support Knowledge Base and Community web site.

You may also want to read a paper I presented at the 2013 SAS Global Forum that has sections dealing with XML data. The paper is titled, "The Ins and Outs of Web-Based Data with SAS". You can access the paper at:

     Technical Papers and Presentations made by SAS staff

The AUTOMAP option is discussed on page 7.

Occasional Contributor
Posts: 5

Re: read-in a XML-file

Posted in reply to BillM_SAS

PERFECT. Thank you. I've tried the XML-Mapper but I didnt get the result I want. With the AUTOMAP-Option it works!

Ask a Question
Discussion stats
  • 2 replies
  • 291 views
  • 1 like
  • 2 in conversation