<?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: replace in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667706#M23055</link>
    <description>Better this.&lt;BR /&gt;prxchange('s/\b26\b/34/',-1,txt)&lt;BR /&gt;or&lt;BR /&gt;prxchange('s/-26-/-34-/',-1,txt)&lt;BR /&gt;otherwise , if txt1=dru-26-12326  , would get wrong result.</description>
    <pubDate>Wed, 08 Jul 2020 13:35:57 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-07-08T13:35:57Z</dc:date>
    <item>
      <title>replace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667470#M23033</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I have dru-26-12345&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pru-26-56743&lt;/P&gt;&lt;P&gt;I want to change 26 to 34&lt;/P&gt;&lt;P&gt;dru-34-12345&lt;/P&gt;&lt;P&gt;pru-34-56743&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please let me know.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 15:22:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667470#M23033</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2020-07-07T15:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: replace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667481#M23035</link>
      <description>&lt;P&gt;option 1 - use tranwrd function,&lt;/P&gt;
&lt;P&gt;option 2 - use prxchange function&lt;/P&gt;
&lt;P&gt;as shown in next log output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;72         
 73         data _null_;
 74           txt = 'dru-26-12345';
 75           txt1 = prxchange('s/26/34/',-1,txt); put txt1=;
 76           txt2 = tranwrd(txt,'26','34'); put  txt2=;
 78         run;
 
 txt1=dru-34-12345
 txt2=dru-34-12345&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 15:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667481#M23035</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-07-07T15:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: replace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667484#M23036</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
var='dru-26-12345';
output;
var='pru-26-56743';
output;
run;

data want;
 set have;
 var1=prxchange('s/([a-z]{3})-(26)-(\d{5})/$1-34-$3/i', -1, var);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 15:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667484#M23036</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-07-07T15:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: replace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667486#M23037</link>
      <description>The 's' in prxchange stands for 'substitute'/&lt;BR /&gt;&lt;BR /&gt;'tranwrd' stands for translate word.</description>
      <pubDate>Tue, 07 Jul 2020 15:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667486#M23037</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-07-07T15:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: replace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667490#M23038</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
var='dru-26-12345';
output;
var='pru-26-56743';
output;
run;
data want;
 set have;
 if substr(var,5,2)='26' then substr(var,5,2)='34';
run;

/*OR*/
data want;
 set have;
 if scan(var,2,'-')='26' then substr(var,5,2)='34';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 17:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667490#M23038</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-07-07T17:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: replace</title>
      <link>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667706#M23055</link>
      <description>Better this.&lt;BR /&gt;prxchange('s/\b26\b/34/',-1,txt)&lt;BR /&gt;or&lt;BR /&gt;prxchange('s/-26-/-34-/',-1,txt)&lt;BR /&gt;otherwise , if txt1=dru-26-12326  , would get wrong result.</description>
      <pubDate>Wed, 08 Jul 2020 13:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/replace/m-p/667706#M23055</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-07-08T13:35:57Z</dc:date>
    </item>
  </channel>
</rss>

