<?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: Updating all the second occurance of specific letter in a string in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750937#M39014</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; ,Thank you so much. But, Can you please explain about your code. I know that prxchange will check based on the bracket. But, Not getting completely. So it would be helpful if you explain your code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jun 2021 11:38:37 GMT</pubDate>
    <dc:creator>_el_doredo</dc:creator>
    <dc:date>2021-06-29T11:38:37Z</dc:date>
    <item>
      <title>Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750667#M38998</link>
      <description>&lt;P&gt;Hi Experts,&lt;BR /&gt;I have one doubt .. I hope you guys can clarify my doubt..&lt;/P&gt;
&lt;P&gt;%let string=the quick brown fox jumps over the lazy dog; /*all low case letters*/&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This is the string, now I need to update all the second occurrence of 'o' letter to capital one... how I will achieve it? Any ideas??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My output should be like this&lt;/P&gt;
&lt;P&gt;"the quick brown fOx jumps over the lazy dOg"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 13:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750667#M38998</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-06-27T13:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750675#M38999</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;My output should be like this&lt;/P&gt;
&lt;P&gt;"the quick brown fOx jumps over the lazy dOg"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Should that be: the quick brown fOx jumps &lt;FONT color="#FF0000"&gt;O&lt;/FONT&gt;ver the lazy dOg&amp;nbsp; ??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/ds2ref/p1av9l9stnh7ptn19ydjwgu0amgd.htm" target="_self"&gt;TRANSLATE function&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    text='the quick brown fox jumps over the lazy dog';
run;

data want;
    set have;
    location_of_first_letter_o = find(text,'o');
    substr(text,location_of_first_letter_o+1)=translate(substr(text,location_of_first_letter_o+1),'O','o');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 15:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750675#M38999</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-27T15:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750678#M39000</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; , Thanks for your answer. But, I need alternate 'o' to be upper case&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 15:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750678#M39000</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-06-27T15:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750681#M39001</link>
      <description>&lt;P&gt;In that case, I think you have to loop over the entire character string to identify the even numbered occurrences of letter 'o'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    location_of_letter_o=0;
    count=1;
    do while (find(substr(text,location_of_letter_o+1),'o')&amp;gt;0);
        location_of_letter_o=location_of_letter_o+find(substr(text,location_of_letter_o+1),'o');
        if mod(count,2)=0 then substr(text,location_of_letter_o,1)='O';
        count=count+1;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Jun 2021 16:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750681#M39001</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-27T16:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750789#M39006</link>
      <description>&lt;PRE&gt;data have;
    text='the quick brown fox jumps over the lazy dog';
run;

data want;
    set have;
want=prxchange('s/(o[^o]*)(o)/\1\U\2/',-1,text);
run;

proc print;run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jun 2021 12:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750789#M39006</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-28T12:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750937#M39014</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; ,Thank you so much. But, Can you please explain about your code. I know that prxchange will check based on the bracket. But, Not getting completely. So it would be helpful if you explain your code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 11:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750937#M39014</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-06-29T11:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750938#M39015</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; Thank you so much.. I'll work on this one and i'll learn about it&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 11:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750938#M39015</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2021-06-29T11:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Updating all the second occurance of specific letter in a string</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750940#M39016</link>
      <description>&lt;P&gt;(o[^o]*)(o)&lt;BR /&gt;--&amp;gt;&lt;BR /&gt;stand for looking for two part (o[^o]*) and (o).&lt;BR /&gt;first part , o means 'o' , [^o] means any character which is not 'o' , * means match [^o] zero or more times.&lt;BR /&gt;second part is easy ,just match 'o' .&lt;BR /&gt;&lt;BR /&gt;Put it all together is looking for a string which have two 'o' .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;\1\U\2&lt;BR /&gt;--&amp;gt;&lt;BR /&gt;\1 means the first matched part (o[^o]*) &lt;BR /&gt;\U means upper case the following character&lt;BR /&gt;\2 means the second matched part (o)&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;For Example:&lt;/P&gt;
&lt;P&gt;the first looking is&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;own fo&lt;BR /&gt;The first part is (own f) ,the second part is (o) , \U will uppercase the second part (o) , so the result is 'own fO'&lt;/PRE&gt;
&lt;P&gt;the second looking is as the same:&lt;/P&gt;
&lt;PRE&gt;over the lazy do&lt;BR /&gt;The first part is (over the lazy d) ,the second part is (o) , \U will uppercase the second part (o) , so the result is 'over the lazy dO'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 12:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Updating-all-the-second-occurance-of-specific-letter-in-a-string/m-p/750940#M39016</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-29T12:16:42Z</dc:date>
    </item>
  </channel>
</rss>

