<?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 How to avoid the root element &amp;lt;ROWSET&amp;gt; in an xml file to be replace by &amp;lt;TABLE&amp;gt; in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-avoid-the-root-element-lt-ROWSET-gt-in-an-xml-file-to-be/m-p/485478#M31462</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am converting a dataset into an XML file using EG 7.11.&amp;nbsp; I have noticed that even if I use xmltype=oracle, when I add a tagset conditions, it replace &amp;lt;ROWSET&amp;gt; for &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code.&amp;nbsp; In the first example, I don't use any tagset condition so the root element &amp;lt;ROWSET&amp;gt; remains in the xml file.&lt;/P&gt;&lt;P&gt;However, when I add any tagset condition, the root element is replaced for &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we avoid that?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let Path=\\...;&lt;BR /&gt;libname trans xml "&amp;amp;Path.\Documents\Test\XML\class.xml" xmltype=oracle;&lt;/P&gt;&lt;P&gt;data trans.class noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;BR /&gt;run;&lt;BR /&gt;libname trans xml "&amp;amp;Path.\Documents\Test\XML\class.xml" xmltype=oracle&lt;BR /&gt;tagset=tagsets.sasxmnsp;&lt;/P&gt;&lt;P&gt;data trans.class noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Aug 2018 14:03:57 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2018-08-09T14:03:57Z</dc:date>
    <item>
      <title>How to avoid the root element &lt;ROWSET&gt; in an xml file to be replace by &lt;TABLE&gt;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-avoid-the-root-element-lt-ROWSET-gt-in-an-xml-file-to-be/m-p/485478#M31462</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am converting a dataset into an XML file using EG 7.11.&amp;nbsp; I have noticed that even if I use xmltype=oracle, when I add a tagset conditions, it replace &amp;lt;ROWSET&amp;gt; for &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code.&amp;nbsp; In the first example, I don't use any tagset condition so the root element &amp;lt;ROWSET&amp;gt; remains in the xml file.&lt;/P&gt;&lt;P&gt;However, when I add any tagset condition, the root element is replaced for &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we avoid that?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let Path=\\...;&lt;BR /&gt;libname trans xml "&amp;amp;Path.\Documents\Test\XML\class.xml" xmltype=oracle;&lt;/P&gt;&lt;P&gt;data trans.class noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;BR /&gt;run;&lt;BR /&gt;libname trans xml "&amp;amp;Path.\Documents\Test\XML\class.xml" xmltype=oracle&lt;BR /&gt;tagset=tagsets.sasxmnsp;&lt;/P&gt;&lt;P&gt;data trans.class noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set sashelp.class;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 14:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-avoid-the-root-element-lt-ROWSET-gt-in-an-xml-file-to-be/m-p/485478#M31462</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-08-09T14:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid the root element &lt;ROWSET&gt; in an xml file to be replace by &lt;TABLE&gt;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-avoid-the-root-element-lt-ROWSET-gt-in-an-xml-file-to-be/m-p/488004#M31558</link>
      <description>&lt;P&gt;Trying to get exactly what one wants from SAS tagsets has proven, at least for me, to be a difficult task.&amp;nbsp; What I've done is to write post-processing programs that make some final adjustments to the XML, adjustments I just couldn't figure out how to get SAS to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example.&amp;nbsp; This post-processing program does two things:&amp;nbsp; 1.&amp;nbsp; It changes Numeric definitions to Text (so I don't lose leading zeros and such) and it deletes rows after a "MergeAcross".&amp;nbsp; What I want is to merge several columns on one of the rows.&amp;nbsp; &amp;nbsp;SAS generates the correct XML in the merged columns... but then writes out the very columns it was supposed to merge.&amp;nbsp; I could not figure out how to get SAS to write the XML correctly, so I just wrote a quickie program to get rid of the extraneous columns myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the code.&amp;nbsp; Hopefully you can do something like the below to get what you need.&amp;nbsp; Trying to get SAS to produce exactly what you need in terms of XML is like trying to scratch your ear with your elbow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
*------------------------------------------------------------------------------------------------*;

FILENAME	XML_In			"&amp;amp;Output_Path/Temporary_Work_File.Txt";
&amp;amp;NoMacs		%Error_Check	(MsgLvl=&amp;amp;MsgLvl, ErrLvl=&amp;amp;ErrLvl);

FILENAME	XML_Out			"&amp;amp;Output_Path/&amp;amp;Fro_Pro_File";
&amp;amp;NoMacs		%Error_Check	(MsgLvl=&amp;amp;MsgLvl, ErrLvl=&amp;amp;ErrLvl);

**	Post process the xml, deleting cells after a MergeAcross.	**;
DATA	_NULL_;
	RETAIN	_First_Time			1;
	RETAIN	_Delete_Records		0;

	IF	_First_Time									THEN
		DO;
			_First_Time						=	0;
			SYSECHO	"Post processing &amp;amp;Fro_Pro_File";
		END;

	INFILE	XML_In
		LENGTH								=	_SAS_Length
		;

	INPUT	@1	_Entire_Record	$VARYING32767.	_SAS_Length;

	IF	MISSING(_Entire_Record)						THEN
		DELETE;

	_Entire_Record	=	TRANWRD(_Entire_Record,'&amp;lt;Data ss:Type="Number"&amp;gt;','&amp;lt;Data ss:Type="String"&amp;gt;');

	FILE	XML_Out;

	IF	INDEX(_Entire_Record,"MergeAcross")	&amp;gt;	0	THEN
		DO;
			_Delete_Records					=	1;
			PUT	@1	_Entire_Record	$VARYING32767.	_SAS_Length;
		END;
	ELSE
	IF	_Delete_Records								THEN
		IF	INDEX(_Entire_Record,"&amp;lt;/Row&amp;gt;")	&amp;gt;	0	THEN
			DO;
				_Delete_Records				=	0;
				PUT	@1	_Entire_Record	$VARYING32767.	_SAS_Length;
			END;
		ELSE
			DO;
				DELETE;
			END;
	ELSE
		DO;
			PUT	@1	_Entire_Record	$VARYING32767.	_SAS_Length;
		END;
RUN;

*------------------------------------------------------------------------------------------------*;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Aug 2018 15:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-avoid-the-root-element-lt-ROWSET-gt-in-an-xml-file-to-be/m-p/488004#M31558</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2018-08-18T15:44:43Z</dc:date>
    </item>
  </channel>
</rss>

