<?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: Is it possible to export multiple datasets to single XML file? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165734#M31968</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tagsets.excelxp, for instance, can put the results of several steps into one xml file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a customized xml structure, you will need a fitting tagset, or you do it by hand in a data step. And I don't think you can beat a properly written data step, timewise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Nov 2014 11:59:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2014-11-11T11:59:55Z</dc:date>
    <item>
      <title>Is it possible to export multiple datasets to single XML file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165732#M31966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know if it is possible to combine multiple datasets when exporting to a single XML file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The specific example I have in mind is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Required XML Logical structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our customers can have one or more accounts and can belong to one or more customer groups, so the structure of XML that I need to create is one record per customer and multiple sub-records at the same hierarchical level for each account and customer group, i.e. something like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;customer&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;customer_id&amp;gt;1234&amp;lt;/customer_id&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ...other customer attributes...&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;subrecord - account&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;account_id&amp;gt;ACCT0001&amp;lt;/account_id&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...account attributes...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/subrecord&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;subrecord - account&amp;gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;account_id&amp;gt;ACCT0002&amp;lt;/account_id&amp;gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...account attributes...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/subrecord&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;subrecord - customer type&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cust_type_id&amp;gt;BUSINESS&amp;lt;/account_id&amp;gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...customer type attributes...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/subrecord&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/customer&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Current SAS data structures&lt;/P&gt;&lt;P&gt;Currently the data that I need to build the XML from is stored in 3 tables.&lt;/P&gt;&lt;P&gt;a) Customer which is keyed on customer_id.&lt;/P&gt;&lt;P&gt;b) Customer_accounts which is keyed on customer_id and account_id&lt;/P&gt;&lt;P&gt;c) Customer_types which is keyed on customer_id and cust_type_id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Approach&lt;/P&gt;&lt;P&gt;I can build the required XML file in an old school way by using a data step that incorporates a set statement for each of the (sorted) tables listed above with multiple put statements. However, even though this works I am wondering whether there is a more efficient (i.e faster in elapsed time) way to do this using the XML engine or other more recently developed SAS tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After searching online I've not found any examples of XML exports that use multiple tables. If I can only use a single dataset then this implies that I have to restructure the input data by merging into a single table that has duplicate customer (and potentially account) values across multiple records. Can I configure the XML hierachy to create the multiple sub-record types that I will need?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologies if this hasn't been posted to the correct community - I wasn't sure of the most appropriate place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 11:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165732#M31966</guid>
      <dc:creator>jj_mk</dc:creator>
      <dc:date>2014-11-11T11:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to export multiple datasets to single XML file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165733#M31967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, my first answer would have been code it by hand as you have full functionality then, but I see reading down you already know that.&amp;nbsp; The only other thing I can think of is to write a tagset.&amp;nbsp; Right click on Results in the results window and select templates.&amp;nbsp; Then navigate to Excelbase for instance and you can see the one developed for Export To ExcelXP.&amp;nbsp; However its a fair bit of work, so if its just for a one off, your probably better with the put statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 11:35:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165733#M31967</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-11T11:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to export multiple datasets to single XML file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165734#M31968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tagsets.excelxp, for instance, can put the results of several steps into one xml file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a customized xml structure, you will need a fitting tagset, or you do it by hand in a data step. And I don't think you can beat a properly written data step, timewise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 11:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-it-possible-to-export-multiple-datasets-to-single-XML-file/m-p/165734#M31968</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-11-11T11:59:55Z</dc:date>
    </item>
  </channel>
</rss>

