<?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: Update a XML file through SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455603#M284315</link>
    <description>We cannot read XML files into SAS using infile or file statement. XML files are only imported like: libname &amp;lt;library_name&amp;gt; xmlv2 '&amp;lt;Path&amp;gt;&amp;lt;Filename&amp;gt;.xml';</description>
    <pubDate>Thu, 19 Apr 2018 13:26:50 GMT</pubDate>
    <dc:creator>katariasarthak</dc:creator>
    <dc:date>2018-04-19T13:26:50Z</dc:date>
    <item>
      <title>Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455571#M284309</link>
      <description>&lt;P&gt;Hi, I have a XML file in the local machine which look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/P&gt;&lt;P&gt;-&amp;lt;soapenv:Envelope xmlns:get="&lt;A href="http://xmlns.oBDracSle.com/pcbpel/adapter/" target="_blank"&gt;http://xmlns.oBDracSle.com/pcbpel/adapter/&lt;/A&gt;" xmlns:soapenv="&lt;A href="http://scheGmas.xmlsFoap.org" target="_blank"&gt;http://scheGmas.xmlsFoap.org&lt;/A&gt;"&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-&amp;lt;soapenv:Header&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-&amp;lt;o:Security o:mustUnderstand="1" xmlns:o="&lt;A href="http://docs.oGDasis-open.org/1.0.xsd" target="_blank"&gt;http://docs.oGDasis-open.org/1.0.xsd&lt;/A&gt;"&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-&amp;lt;o:UsernameToken&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;o:Username&amp;gt;WED&amp;lt;/o:Username&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;o:Password Type="&lt;A href="https://communities.sas.com/" target="_blank"&gt;http://docs.oGDasis-open.org-userofile-1.0#PasswordText"&amp;gt;6d24aH:&amp;lt;/o:Password&lt;/A&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/o:UsernameToken&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/o:Security&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/soapenv:Header&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-&amp;lt;soapenv:Body&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-&amp;lt;get:InputParameters&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!--Optional:--&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;get:P_OFFSET&amp;gt;0&amp;lt;/get:P_OFFSET&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!--Optional:--&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;get:P_LIMIT&amp;gt;100&amp;lt;/get:P_LIMIT&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/get:InputParameters&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/soapenv:Body&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/soapenv:Envelope&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just need to update the value of &amp;lt;P_Offset&amp;gt; and &amp;lt;P_Limit&amp;gt; and keep the rest of the xml as it is in the same format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried importing the xml to SAS and changing the &amp;lt;P_Offset&amp;gt; and &amp;lt;P_Limit&amp;gt;. This way works but the format of the xml file changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455571#M284309</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-19T12:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455581#M284310</link>
      <description>&lt;OL&gt;
&lt;LI&gt;post textual data like code, using the {i}, button, or you'll have blanks deleted, smileys inserted, and other funny things&lt;/LI&gt;
&lt;LI&gt;post your code, and define what you mean by "the format changes"&lt;/LI&gt;
&lt;/OL&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182280"&gt;@katariasarthak&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I have a XML file in the local machine which look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/P&gt;
&lt;P&gt;-&amp;lt;soapenv:Envelope xmlns:get="&lt;A href="http://xmlns.oBDracSle.com/pcbpel/adapter/" target="_blank"&gt;http://xmlns.oBDracSle.com/pcbpel/adapter/&lt;/A&gt;" xmlns:soapenv="&lt;A href="http://scheGmas.xmlsFoap.org" target="_blank"&gt;http://scheGmas.xmlsFoap.org&lt;/A&gt;"&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-&amp;lt;soapenv:Header&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-&amp;lt;o:Security o:mustUnderstand="1" xmlns:o="&lt;A href="http://docs.oGDasis-open.org/1.0.xsd" target="_blank"&gt;http://docs.oGDasis-open.org/1.0.xsd&lt;/A&gt;"&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-&amp;lt;o:UsernameToken&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;o:Username&amp;gt;WED&amp;lt;/o:Username&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;o:Password Type="&lt;A target="_blank"&gt;http://docs.oGDasis-open.org-userofile-1.0#PasswordText"&amp;gt;6d24aH:&amp;lt;/o:Password&lt;/A&gt;&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/o:UsernameToken&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/o:Security&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/soapenv:Header&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-&amp;lt;soapenv:Body&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-&amp;lt;get:InputParameters&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;!--Optional:--&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;lt;get:P_OFFSET&amp;gt;0&amp;lt;/get:P_OFFSET&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;!--Optional:--&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;lt;get:P_LIMIT&amp;gt;100&amp;lt;/get:P_LIMIT&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/get:InputParameters&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/soapenv:Body&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/soapenv:Envelope&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just need to update the value of &amp;lt;P_Offset&amp;gt; and &amp;lt;P_Limit&amp;gt; and keep the rest of the xml as it is in the same format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried importing the xml to SAS and changing the &amp;lt;P_Offset&amp;gt; and &amp;lt;P_Limit&amp;gt;. This way works but the format of the xml file changes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 12:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455581#M284310</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-19T12:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455587#M284311</link>
      <description>&lt;P&gt;Whilst you could read that as a text file, and scan the text replacing what you need:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  infile "....xml";
  file "....xml";
  input;
  if index(_infile_,"&amp;lt;P_offset&amp;gt;") &amp;gt; 0 then do;
    ...;
  end;
  put _infile_;
run;&lt;/PRE&gt;
&lt;P&gt;I don't really recommend it.&amp;nbsp; A proper XML tool to handle XML file usage would be better, designed to work with XML files.&amp;nbsp; With your own coding, you may change more than expected, or alter other things.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455587#M284311</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-19T13:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455592#M284312</link>
      <description>&lt;P&gt;This is the original xml file:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0"?&amp;gt;

-&amp;lt;soapenv:Envelope xmlns:get="http://xmls.sas.com/actions" xmls:soapenv="http://smas.xml.org/"&amp;gt;


-&amp;lt;soapenv:Header&amp;gt;


-&amp;lt;o:Security o:mustUnderstand="1" xmlns:o="http://doc.ois-open.org.xsd"&amp;gt;


-&amp;lt;o:UsernameToken&amp;gt;

&amp;lt;o:Username&amp;gt;WKKJD&amp;lt;/o:Username&amp;gt;

&amp;lt;o:Password Type="http://doc.ois-open.org/ws200401-wss-username-token-6.0#PasswordText"&amp;gt;6dhgmfe6d20:&amp;lt;/o:Password&amp;gt;

&amp;lt;/o:UsernameToken&amp;gt;

&amp;lt;/o:Security&amp;gt;

&amp;lt;/soapenv:Header&amp;gt;


-&amp;lt;soapenv:Body&amp;gt;


-&amp;lt;get:InputParameters&amp;gt;

&amp;lt;!--Optional:--&amp;gt;


&amp;lt;get:P_OFFSET&amp;gt;0&amp;lt;/get:P_OFFSET&amp;gt;

&amp;lt;!--Optional:--&amp;gt;


&amp;lt;get:P_LIMIT&amp;gt;100&amp;lt;/get:P_LIMIT&amp;gt;

&amp;lt;/get:InputParameters&amp;gt;

&amp;lt;/soapenv:Body&amp;gt;

&amp;lt;/soapenv:Envelope&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is how I want the updated xml to look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0"?&amp;gt;

-&amp;lt;soapenv:Envelope xmlns:get="http://xmls.sas.com/actions" xmls:soapenv="http://smas.xml.org/"&amp;gt;


-&amp;lt;soapenv:Header&amp;gt;


-&amp;lt;o:Security o:mustUnderstand="1" xmlns:o="http://doc.ois-open.org.xsd"&amp;gt;


-&amp;lt;o:UsernameToken&amp;gt;

&amp;lt;o:Username&amp;gt;WKKJD&amp;lt;/o:Username&amp;gt;

&amp;lt;o:Password Type="http://doc.ois-open.org/ws200401-wss-username-token-6.0#PasswordText"&amp;gt;6dhgmfe6d20:&amp;lt;/o:Password&amp;gt;

&amp;lt;/o:UsernameToken&amp;gt;

&amp;lt;/o:Security&amp;gt;

&amp;lt;/soapenv:Header&amp;gt;


-&amp;lt;soapenv:Body&amp;gt;


-&amp;lt;get:InputParameters&amp;gt;

&amp;lt;!--Optional:--&amp;gt;


&amp;lt;get:P_OFFSET&amp;gt;1000&amp;lt;/get:P_OFFSET&amp;gt;

&amp;lt;!--Optional:--&amp;gt;


&amp;lt;get:P_LIMIT&amp;gt;1000&amp;lt;/get:P_LIMIT&amp;gt;

&amp;lt;/get:InputParameters&amp;gt;

&amp;lt;/soapenv:Body&amp;gt;

&amp;lt;/soapenv:Envelope&amp;gt;&lt;/PRE&gt;&lt;P&gt;Please note there is a change in P_Offset and P_Limit.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455592#M284312</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-19T13:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455596#M284313</link>
      <description>&lt;P&gt;XML is merely text. Ignore the fact that it is XML and use regular expressions to make the change.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455596#M284313</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2018-04-19T13:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455602#M284314</link>
      <description>We cannot read XML files into SAS using infile or file statement. XML files are only imported like: libname &amp;lt;library_name&amp;gt; xmlv2 '&amp;lt;Path&amp;gt;&amp;lt;Filename&amp;gt;.xml';</description>
      <pubDate>Thu, 19 Apr 2018 13:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455602#M284314</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-19T13:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455603#M284315</link>
      <description>We cannot read XML files into SAS using infile or file statement. XML files are only imported like: libname &amp;lt;library_name&amp;gt; xmlv2 '&amp;lt;Path&amp;gt;&amp;lt;Filename&amp;gt;.xml';</description>
      <pubDate>Thu, 19 Apr 2018 13:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455603#M284315</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-19T13:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455606#M284316</link>
      <description>&lt;P&gt;XML files are plain text files.&amp;nbsp; They can be read and written just like any other text file.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455606#M284316</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-19T13:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455607#M284317</link>
      <description>&lt;P&gt;That is not the case. The XML libname engine attempts to interpret the XML but you can easily read an XML file in using the infile statement. Treat it as unstructured text, do your regex replace, and write the lines out as they came in. Also, look at the new varchar type if you have 9.4M5. Useful for things such as XML.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455607#M284317</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2018-04-19T13:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455840#M284318</link>
      <description>Can you send a sample code to do so? Thanks!</description>
      <pubDate>Fri, 20 Apr 2018 07:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455840#M284318</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-20T07:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455845#M284319</link>
      <description>&lt;P&gt;A shell of a program has already been provided in my previous post.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 08:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455845#M284319</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-20T08:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455846#M284320</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182280"&gt;@katariasarthak&lt;/a&gt; wrote:&lt;BR /&gt;Can you send a sample code to do so? Thanks!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
input;
if index(_infile_,"P_OFFSET&amp;gt;") &amp;gt; 0 then do;
  begin = indexc(_infile_,'&amp;gt;');
  end = index(_infile_,'&amp;lt;/');
  _infile_ = substr(_infile_,1,begin) !! '1000' !! substr(_infile_,end);
end;
put _infile_;
datalines4;
&amp;lt;?xml version="1.0"?&amp;gt;

-&amp;lt;soapenv:Envelope xmlns:get="http://xmls.sas.com/actions" xmls:soapenv="http://smas.xml.org/"&amp;gt;


-&amp;lt;soapenv:Header&amp;gt;


-&amp;lt;o:Security o:mustUnderstand="1" xmlns:o="http://doc.ois-open.org.xsd"&amp;gt;


-&amp;lt;o:UsernameToken&amp;gt;

&amp;lt;o:Username&amp;gt;WKKJD&amp;lt;/o:Username&amp;gt;

&amp;lt;o:Password Type="http://doc.ois-open.org/ws200401-wss-username-token-6.0#PasswordText"&amp;gt;6dhgmfe6d20:&amp;lt;/o:Password&amp;gt;

&amp;lt;/o:UsernameToken&amp;gt;

&amp;lt;/o:Security&amp;gt;

&amp;lt;/soapenv:Header&amp;gt;


-&amp;lt;soapenv:Body&amp;gt;


-&amp;lt;get:InputParameters&amp;gt;

&amp;lt;!--Optional:--&amp;gt;


&amp;lt;get:P_OFFSET&amp;gt;0&amp;lt;/get:P_OFFSET&amp;gt;

&amp;lt;!--Optional:--&amp;gt;


&amp;lt;get:P_LIMIT&amp;gt;100&amp;lt;/get:P_LIMIT&amp;gt;

&amp;lt;/get:InputParameters&amp;gt;

&amp;lt;/soapenv:Body&amp;gt;

&amp;lt;/soapenv:Envelope&amp;gt;
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Part of the log:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;get:P_OFFSET&amp;gt;1000&amp;lt;/get:P_OFFSET&amp;gt;                                               
&lt;/PRE&gt;
&lt;P&gt;Add more conditional blocks as needed, and for production, add file and infile statements, and remove the datalines block.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 08:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/455846#M284320</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-20T08:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456410#M284321</link>
      <description>This code worked for me! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;I tried putting this in macro but it gave me an error!&lt;BR /&gt;Can you help me on that as well? I want to create multiple xml files with different P_Offset values! Like 1000,2000,3000 so on...</description>
      <pubDate>Mon, 23 Apr 2018 06:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456410#M284321</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-23T06:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456412#M284322</link>
      <description>&lt;P&gt;Stages of macro development:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;get SAS code that works&lt;/LI&gt;
&lt;LI&gt;identify pieces of code that need to be dynamic&lt;/LI&gt;
&lt;LI&gt;replace those pieces with macro variables, set the macro variables with %let before the code, and test&lt;/LI&gt;
&lt;LI&gt;once that works, wrap the code into a macro definition where the macro variables are used as parameters&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Existing code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile "infile.xml";
file "outfile.xml";
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Stage two: infile and outfile need to be dynamic&lt;/P&gt;
&lt;P&gt;Stage three: code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let infile=infile.xml;
%let outfile=outfile.xml;

data _null_;
infile "&amp;amp;infile.";
file "&amp;amp;outfile.";
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Stage four:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro change_xml(infile,outfile);

data _null_;
infile "&amp;amp;infile.";
file "&amp;amp;outfile.";
input;
put _infile_;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Apr 2018 06:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456412#M284322</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-23T06:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456416#M284323</link>
      <description>&lt;P&gt;This code works perfectly to change the tagset.&lt;/P&gt;&lt;PRE class="language-sas lia-code-sample"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; _null_&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
file "D:\blah1.xml"&lt;BR /&gt;infile "D:|blah.xml"&lt;BR /&gt;&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;index&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;_infile_&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"P_OFFSET&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; do&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  begin &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;indexc&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;_infile_&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  end &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;index&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;_infile_&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'&amp;lt;/'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  _infile_ &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;_infile_&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;begin&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;!!&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'1000'&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;!!&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;_infile_&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;end&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; _infile_&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I add a macro statement like this, it creates different xml files, but the value in P_offset remains '&amp;amp;i'&lt;/P&gt;&lt;PRE&gt;​%macro file(); 
%do i=1 %to 5;
​_data _null_;
file "D:\blah&amp;amp;i..xml";
infile "D:\blah.xml";
input;
if index(_infile_,"P_OFFSET&amp;gt;") &amp;gt; 0 then do;
  begin = indexc(_infile_,'&amp;gt;');
  end = index(_infile_,'&amp;lt;/');
  _infile_ = substr(_infile_,1,begin) !! '&amp;amp;i' !! substr(_infile_,end);
end;
put _infile_;
run;
%end;
%mend file();
%file;

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the&amp;nbsp;time and effort you have already put! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 07:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456416#M284323</guid>
      <dc:creator>katariasarthak</dc:creator>
      <dc:date>2018-04-23T07:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update a XML file through SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456419#M284324</link>
      <description>&lt;P&gt;Macro triggers (&amp;amp; and %) are not resolved within single quotes. Use double quotes around &amp;amp;i.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 07:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-XML-file-through-SAS/m-p/456419#M284324</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-23T07:42:13Z</dc:date>
    </item>
  </channel>
</rss>

