BookmarkSubscribeRSS Feed
grimol
Calcite | Level 5


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>

2 REPLIES 2
BillM_SAS
SAS Employee

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.

grimol
Calcite | Level 5

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 987 views
  • 1 like
  • 2 in conversation