<?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: prxchange to replace two or more strings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495395#M130735</link>
    <description>&lt;P&gt;Like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input date &amp;amp;$100.;&lt;BR /&gt;length new $ 100;&lt;BR /&gt;/*new = prxchange('s/\bUNK\b/---/', -1, date);*/&lt;BR /&gt;/*new = prxchange('s/\bUN\b/--/', -1, new);*/&lt;BR /&gt;new = prxchange('s/\bUN\b/--/', -1, prxchange('s/\bUNK\b/---/', -1, date));&lt;BR /&gt;cards;&lt;BR /&gt;UN UNK 2018&lt;BR /&gt;;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Sep 2018 16:32:08 GMT</pubDate>
    <dc:creator>Shemp</dc:creator>
    <dc:date>2018-09-13T16:32:08Z</dc:date>
    <item>
      <title>prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495360#M130722</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to replace the 'UN' and 'UNK' two strings with '--' and '---' with prxchange. Could you please help me with the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new=prxchange('s/(\bUN\b)|(\bUNK\b)/---/',-1,date);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date &amp;amp;$100.;
cards;
UN UNK 2018
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Sep 2018 15:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495360#M130722</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-09-13T15:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495384#M130731</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;input date &amp;amp;$100.;&lt;BR /&gt;length new $ 100;&lt;BR /&gt;new = prxchange('s/\bUNK\b/---/', -1, date);&lt;BR /&gt;new = prxchange('s/\bUN\b/--/', -1, new);&lt;BR /&gt;cards;&lt;BR /&gt;UN UNK 2018&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 16:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495384#M130731</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2018-09-13T16:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495387#M130733</link>
      <description>&lt;P&gt;Thanks for your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Isn't possible to do it in a single line in the same prxchange rather than in two separate lines.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 16:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495387#M130733</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-09-13T16:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495394#M130734</link>
      <description>I don't believe it is possible to do in a single line unless you embed a prxchange function as the 3rd argument to a prxchange function.</description>
      <pubDate>Thu, 13 Sep 2018 16:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495394#M130734</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2018-09-13T16:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495395#M130735</link>
      <description>&lt;P&gt;Like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input date &amp;amp;$100.;&lt;BR /&gt;length new $ 100;&lt;BR /&gt;/*new = prxchange('s/\bUNK\b/---/', -1, date);*/&lt;BR /&gt;/*new = prxchange('s/\bUN\b/--/', -1, new);*/&lt;BR /&gt;new = prxchange('s/\bUN\b/--/', -1, prxchange('s/\bUNK\b/---/', -1, date));&lt;BR /&gt;cards;&lt;BR /&gt;UN UNK 2018&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 16:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/495395#M130735</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2018-09-13T16:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/587079#M167623</link>
      <description>&lt;P&gt;I was working on the prxchange and thought we could simplify the code when compared to accepted solution.&amp;nbsp; Instead of using two prxchange we can do it with one prxchange as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input date &amp;amp;$100.;
date2=prxchange('s/(UN\s)(UNK\s)(\d*)/-- --- $3/i',-1,strip(date));
cards;
UN UNK 2018
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Sep 2019 15:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/587079#M167623</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-08T15:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/587640#M167858</link>
      <description>&lt;P&gt;&lt;FONT&gt;data have;&lt;BR /&gt;input date &amp;amp;$100.;&lt;BR /&gt;date2=prxchange('s/(UN\s)(UNK\s)(\d*)/-- --- $3/i',-1,strip(date));&lt;BR /&gt;cards;&lt;BR /&gt;UN UNK 2018&lt;BR /&gt;UN 2018&lt;BR /&gt;UNK 2018&lt;BR /&gt;UN&lt;BR /&gt;UNK&lt;BR /&gt;;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;In the above, the first line in the CARDS statement works, but the next 4 fail.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 18:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/587640#M167858</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2019-09-10T18:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: prxchange to replace two or more strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/587717#M167879</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;Isn't possible to do it in a single line in the same prxchange rather than in two separate lines.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;It is possible if the replacement string is not changing, for example always ---.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 04:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prxchange-to-replace-two-or-more-strings/m-p/587717#M167879</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-09-11T04:22:09Z</dc:date>
    </item>
  </channel>
</rss>

