<?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: creating a root tag for XML in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432244#M107038</link>
    <description>&lt;P&gt;Hi RW9, I forgot to add in the FILENAME line in the beginning which would have created it into a xml file.&lt;/P&gt;&lt;P&gt;I know that the XML files have that format in which it has those things at the beginning. Which makes me think, should I try and create the tags in a data step that i set alex.interview and just actually add &amp;lt;Hi&amp;gt; before _INTERVIEW_ and &amp;lt;/Hi&amp;gt; after it? would that be a possible way?&lt;/P&gt;&lt;P&gt;Thanks for the help so far!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jan 2018 15:18:46 GMT</pubDate>
    <dc:creator>AlexMoreton</dc:creator>
    <dc:date>2018-01-30T15:18:46Z</dc:date>
    <item>
      <title>creating a root tag for XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432231#M107027</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Thanks to help in this community, I was able to extract a super large file from a SQL database and export it into XML format (required by my teacher). I was able to get each row's value (in string) and concatenate them into one file to be read.&lt;/P&gt;&lt;P&gt;Right now I'm trying to get it to be read by a XML reader such as XML Notepad. However, as each row has the same root tag, I need to create a new tag&lt;/P&gt;&lt;P&gt;So right now i have many strings with the same root tag.&lt;/P&gt;&lt;P&gt;&amp;lt;Interview&amp;gt;Row1&amp;lt;/Interview&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;Interview&amp;gt;Row2&amp;lt;/Interview&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;Interview&amp;gt;Row3&amp;lt;/Interview&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I add a tag before them it can be read, but I would like to be able to just code for it to do so automatically.&lt;/P&gt;&lt;P&gt;to look like this:&lt;/P&gt;&lt;P&gt;&amp;lt;Hi&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;Interview&amp;gt;Row1&amp;lt;/Interview&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;Interview&amp;gt;Row2&amp;lt;/Interview&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;Interview&amp;gt;Row3&amp;lt;/Interview&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;/Hi&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As for the code I simply just used this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data Complete;&lt;BR /&gt;file alex lrecl=90000;&lt;BR /&gt;set Alex.Interview;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*this library already had all the rows in the database and only has one variable which is the interview&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;which I want to merge and become one ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know the code is basically useless but right now I dont really know what to do... This DOES create one XML file that has all the contents I want in it. But it lacks the tag so XML reader can read it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432231#M107027</guid>
      <dc:creator>AlexMoreton</dc:creator>
      <dc:date>2018-01-30T15:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: creating a root tag for XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432236#M107032</link>
      <description>&lt;P&gt;There is nothing in that code you post which an XML file, or in fact any physical file other than a dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you need something like:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set alex.interview end=last;
  file "want.xml";
  if _n_=1 then do;
    put "&amp;lt;Root&amp;gt;";
    put "&amp;lt;Hi&amp;gt;";
  end;
  tmp=cat("&amp;lt;Interview&amp;gt;",yourstring,"&amp;lt;/Interview&amp;gt;");
  put tmp;
  if last then put "&amp;lt;/Root&amp;gt;";
run;&lt;/PRE&gt;
&lt;P&gt;But its very hard to tell.&amp;nbsp; Yo know how to make a well structured XML file I presume, it has a line at the top stating version, encoding etc., then open a tag which is the root, and at end close the root tag...&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432236#M107032</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-30T15:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: creating a root tag for XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432244#M107038</link>
      <description>&lt;P&gt;Hi RW9, I forgot to add in the FILENAME line in the beginning which would have created it into a xml file.&lt;/P&gt;&lt;P&gt;I know that the XML files have that format in which it has those things at the beginning. Which makes me think, should I try and create the tags in a data step that i set alex.interview and just actually add &amp;lt;Hi&amp;gt; before _INTERVIEW_ and &amp;lt;/Hi&amp;gt; after it? would that be a possible way?&lt;/P&gt;&lt;P&gt;Thanks for the help so far!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432244#M107038</guid>
      <dc:creator>AlexMoreton</dc:creator>
      <dc:date>2018-01-30T15:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: creating a root tag for XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432253#M107043</link>
      <description>&lt;P&gt;I wouldn't try to do it yourself unless you really need some sort of complicated output:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/engxml/62845/HTML/default/viewer.htm#titlepage.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/engxml/62845/HTML/default/viewer.htm#titlepage.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In particular:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/engxml/62845/HTML/default/viewer.htm#a002975327.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/engxml/62845/HTML/default/viewer.htm#a002975327.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432253#M107043</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-30T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: creating a root tag for XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432258#M107047</link>
      <description>&lt;P&gt;Thanks RW9,&lt;/P&gt;&lt;P&gt;output's not really complicated, I just need to add a tag in front and after the end of the total dataset at alex.interview. Then I can export it and it should be readable on XML Notepad etc. It's just right now I don't know how to do so...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the output is basically the same except it will have a new tag in front and at the end of the dataset. which would be &amp;lt;hi&amp;gt; &amp;lt;/hi&amp;gt;. Is this not really a good idea to do so? because basically I have rows with the same tags &amp;lt;interview&amp;gt; &amp;lt;/interview&amp;gt;. So I just need to create a new tag to become the new root.&lt;/P&gt;&lt;P&gt;Thanks for the advise though! I'll keep trying because it feels like I'm only one step away from making this (which I can do manually, but I just think there HAS to be a code for this).&lt;/P&gt;&lt;P&gt;Thank you RW9&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 15:35:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432258#M107047</guid>
      <dc:creator>AlexMoreton</dc:creator>
      <dc:date>2018-01-30T15:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: creating a root tag for XML</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432287#M107055</link>
      <description>&lt;P&gt;Thank you RW9,&lt;/P&gt;&lt;P&gt;I played around your code and I managed to get it to do exactly what I wanted. Thank you&lt;/P&gt;&lt;P&gt;filename alex 'X:\ALEX TESTING\TRY5.xml';&lt;/P&gt;&lt;P&gt;data tags;&lt;BR /&gt;set work.complete end=last;&lt;BR /&gt;file alex lrecl=90000;&lt;BR /&gt;if _n_=1 then do;&lt;BR /&gt;put "&amp;lt;Hi&amp;gt;";&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;put Interview;&lt;/P&gt;&lt;P&gt;if last then put "&amp;lt;/Hi&amp;gt;";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I'll accept your answer as the answer but this is just in case you wanted to see.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-root-tag-for-XML/m-p/432287#M107055</guid>
      <dc:creator>AlexMoreton</dc:creator>
      <dc:date>2018-01-30T16:03:36Z</dc:date>
    </item>
  </channel>
</rss>

