<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I import XML file into SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284225#M57996</link>
    <description>&lt;P&gt;I don't have XML map. I attached a sample XML file (saved in TXT format for posting). How to get XML map file? I only can get XML file.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jul 2016 23:51:11 GMT</pubDate>
    <dc:creator>Nancy05</dc:creator>
    <dc:date>2016-07-13T23:51:11Z</dc:date>
    <item>
      <title>How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283948#M57913</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just wonder if SAS are able to import XML file. If it is doable, how to do it (SAS code please)? Any requirements on XML file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Nancy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 02:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283948#M57913</guid>
      <dc:creator>Nancy05</dc:creator>
      <dc:date>2016-07-13T02:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283957#M57916</link>
      <description>There is a lot of information about how to import XML using the SAS XML Libname Engine. Depending on the structure of your XML, you might or might not need an XML MAP file to map from the XML to a SAS dataset. There is too much to convey in a small space. Here's the doc reference: &lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/engxml/64990/HTML/default/viewer.htm#n1v7e5etkcqpqgn1lqrombqm6z6b.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/engxml/64990/HTML/default/viewer.htm#n1v7e5etkcqpqgn1lqrombqm6z6b.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Wed, 13 Jul 2016 03:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283957#M57916</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-13T03:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283959#M57917</link>
      <description>&lt;P&gt;Give you an example :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename xx temp;
libname xx xmlv2 '/folders/myfolders/Spearman.xml' automap=replace xmlmap=xx;
proc copy in=xx out=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jul 2016 03:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283959#M57917</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-13T03:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283961#M57919</link>
      <description>&lt;P&gt;Thank you for your SAS code! KSharp&lt;/P&gt;&lt;P&gt;I had tried your code by using real XML file. There is no syntax error! &lt;img id="womanhappy" class="emoticon emoticon-womanhappy" src="https://communities.sas.com/i/smilies/16x16_woman-happy.png" alt="Woman Happy" title="Woman Happy" /&gt; That is good! But only 3 out of 4000 line data imported &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;. Here is my output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;affordability_ORDINAL&amp;nbsp;calculatedTotalAnnualGrossRental&amp;nbsp;amount1&lt;BR /&gt;1&amp;nbsp;1&amp;nbsp;26000&lt;BR /&gt;2&amp;nbsp;2&amp;nbsp;13000&lt;BR /&gt;3&amp;nbsp;3&amp;nbsp;13000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My XML file would have multiple layout - it could be deep in 7 layers. It used "xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you got SAS code to coping with much more complexed XML file please (ie: real world XML file not academic XML file)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Nancy&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 03:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283961#M57919</guid>
      <dc:creator>Nancy05</dc:creator>
      <dc:date>2016-07-13T03:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283962#M57920</link>
      <description>&lt;P&gt;Sorry, Just correct what I said before. The data is imported but not in the structured layout. There are all flat structures and in wrong hierarchy.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 03:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283962#M57920</guid>
      <dc:creator>Nancy05</dc:creator>
      <dc:date>2016-07-13T03:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283963#M57921</link>
      <description>&lt;P&gt;Can you open your XML file in Excel?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without a sample of your XML its hard to help. Can you post a snippet?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 04:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283963#M57921</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-13T04:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283966#M57923</link>
      <description>&lt;P&gt;Do you have XML Map ?&lt;/P&gt;
&lt;P&gt;I attached a PDF. All thing about XML is in there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 04:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/283966#M57923</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-13T04:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284023#M57935</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; The SAS dataset that you import will not maintain the hierarchical structure of your original XML file. Remember that a SAS dataset is a data structure composed of rows and columns, so every row or observation has the same number of columns. &lt;BR /&gt;&lt;BR /&gt;On the other hand, with an XML definition, you could have one structure where the &amp;lt;WOMBAT&amp;gt; element was optional. But SAS does not have the possibility of optional columns. Every row will have the same number of columns -- some of the columns may have missing values on some rows, but the way that it works with importing XML into SAS data format is that your XML elements are turned into SAS columns. There's a very simple example of a non-hierarchical XML file shown in the screen shot below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;BR /&gt;cynthia&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4032i6ED7A7B728199B51/image-size/original?v=v2&amp;amp;px=-1" alt="import_xml_into_sas.png" title="import_xml_into_sas.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 13:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284023#M57935</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-13T13:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284224#M57995</link>
      <description>&lt;P&gt;I can only open XML in Excel as a read-only workbook. Please find the attached sample TXT file. Since I could not post the attachment as XML file, so I saved it in TXT file, you need NotePad++ to convert to XML file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note the data in XML&amp;nbsp;is artifical data not real values. Just to illustrate the XML data structure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if this is doable or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 23:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284224#M57995</guid>
      <dc:creator>Nancy05</dc:creator>
      <dc:date>2016-07-13T23:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import XML file into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284225#M57996</link>
      <description>&lt;P&gt;I don't have XML map. I attached a sample XML file (saved in TXT format for posting). How to get XML map file? I only can get XML file.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 23:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-XML-file-into-SAS/m-p/284225#M57996</guid>
      <dc:creator>Nancy05</dc:creator>
      <dc:date>2016-07-13T23:51:11Z</dc:date>
    </item>
  </channel>
</rss>

