<?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 multiple prxchange together in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933137#M367032</link>
    <description>&lt;P&gt;Is there a way I can use&amp;nbsp; multiple prxchange in one go. i want to replace a with d, b with k, c with l, d with a ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is&amp;nbsp; my input&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;/P&gt;
&lt;P&gt;input_string="abcdjhj";&lt;/P&gt;
&lt;P&gt;input_num=12;&lt;/P&gt;
&lt;P&gt;input_string2= "robin";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data b;&lt;/P&gt;
&lt;P&gt;set a;&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/a/d/',-1,input_string);&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/b/k/',-1,input_string);&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/c/l/',-1,input_string);&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/d/a/',-1,input_string);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as per&amp;nbsp; logic i want changed_string value to be "ddklajhj" but this is not producing correct output and my table b has 16 such character variables i want to apply the same logic for those variables also. Can someone help me with the same&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance. Any help is appreciated&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2024 13:29:27 GMT</pubDate>
    <dc:creator>yashpande</dc:creator>
    <dc:date>2024-06-20T13:29:27Z</dc:date>
    <item>
      <title>multiple prxchange together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933137#M367032</link>
      <description>&lt;P&gt;Is there a way I can use&amp;nbsp; multiple prxchange in one go. i want to replace a with d, b with k, c with l, d with a ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is&amp;nbsp; my input&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;/P&gt;
&lt;P&gt;input_string="abcdjhj";&lt;/P&gt;
&lt;P&gt;input_num=12;&lt;/P&gt;
&lt;P&gt;input_string2= "robin";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data b;&lt;/P&gt;
&lt;P&gt;set a;&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/a/d/',-1,input_string);&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/b/k/',-1,input_string);&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/c/l/',-1,input_string);&lt;/P&gt;
&lt;P&gt;changed_string=prxchange('s/d/a/',-1,input_string);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as per&amp;nbsp; logic i want changed_string value to be "ddklajhj" but this is not producing correct output and my table b has 16 such character variables i want to apply the same logic for those variables also. Can someone help me with the same&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance. Any help is appreciated&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 13:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933137#M367032</guid>
      <dc:creator>yashpande</dc:creator>
      <dc:date>2024-06-20T13:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: multiple prxchange together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933176#M367033</link>
      <description>&lt;P&gt;First a question, in your real data are you changing single letters or longer strings?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second this "want changed_string value to be "ddklajhj" " does not match the description " replace a with d, b with k, c with l, d with a"&amp;nbsp; If we are starting with "abcdjhj" which is 7 characters we don't get "ddklajhj" which is 8 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming your are replacing single characters and that you have a typo in the changed string above:&lt;/P&gt;
&lt;PRE&gt; data example;
    input_string="abcdjhj";
    newstring = translate(input_string,"dkla","abcd");
 run;&lt;/PRE&gt;
&lt;P&gt;TRANSLATE function is only single character replacements which is why I asked. If you have a double-byte character set the function would be KTRANSLATE.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 14:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933176#M367033</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-20T14:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: multiple prxchange together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933187#M367035</link>
      <description>/* a with d, b with k, c with l, d with a , */ data b; set a; input_string = tranwrd(tranwrd(tranwrd(tranwrd(input_string, 'a', 'd'), 'b', 'k'), 'c', 'l'), 'd', 'a'); input_string2 = tranwrd(tranwrd(tranwrd(tranwrd(input_string2, 'a', 'd'), 'b', 'k'), 'c', 'l'), 'd', 'a'); run;</description>
      <pubDate>Thu, 20 Jun 2024 14:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933187#M367035</guid>
      <dc:creator>carl_miles</dc:creator>
      <dc:date>2024-06-20T14:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: multiple prxchange together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933200#M367038</link>
      <description>&lt;P&gt;What value would you expect changed_string to have if you ran:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;changed_string='1';
changed_string='2';
changed_string='3';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you see what your problem is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or let's do it with numbers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x=1;
y=x+2;
y=x+3;
y=x+4;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How should you modify those four statements so that y ends up with 10?&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x=1;
y=x+2;
y=y+3;
y=y+4;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;Can you apply the same thing to your assignment statements?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 16:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-prxchange-together/m-p/933200#M367038</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-06-20T16:41:52Z</dc:date>
    </item>
  </channel>
</rss>

