<?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 Non Repeated letters  positions  in a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927827#M365081</link>
    <description>&lt;PRE&gt;data _null_;&lt;BR /&gt;string = 'antioxidant';&lt;BR /&gt;length unique $200 position_list $200;&lt;BR /&gt;do i = 1 to length(string);&lt;BR /&gt;letter = substr(string, i, 1);&lt;BR /&gt;count = countc(string, letter);&lt;BR /&gt;if count = 1 then do;&lt;BR /&gt;unique = cats(unique, letter);&lt;BR /&gt;position_list = cats(position_list, i);&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;put unique;&lt;BR /&gt;put position_list;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;I want output position of non repeated letters like below&lt;/P&gt;
&lt;TABLE width="343"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="151"&gt;Non-Repeated_Letters&lt;/TD&gt;
&lt;TD width="64"&gt;O&lt;/TD&gt;
&lt;TD width="64"&gt;X&lt;/TD&gt;
&lt;TD width="64"&gt;D&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;antioxidant&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Fri, 10 May 2024 11:29:32 GMT</pubDate>
    <dc:creator>pavank</dc:creator>
    <dc:date>2024-05-10T11:29:32Z</dc:date>
    <item>
      <title>Non Repeated letters  positions  in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927827#M365081</link>
      <description>&lt;PRE&gt;data _null_;&lt;BR /&gt;string = 'antioxidant';&lt;BR /&gt;length unique $200 position_list $200;&lt;BR /&gt;do i = 1 to length(string);&lt;BR /&gt;letter = substr(string, i, 1);&lt;BR /&gt;count = countc(string, letter);&lt;BR /&gt;if count = 1 then do;&lt;BR /&gt;unique = cats(unique, letter);&lt;BR /&gt;position_list = cats(position_list, i);&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;put unique;&lt;BR /&gt;put position_list;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;I want output position of non repeated letters like below&lt;/P&gt;
&lt;TABLE width="343"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="151"&gt;Non-Repeated_Letters&lt;/TD&gt;
&lt;TD width="64"&gt;O&lt;/TD&gt;
&lt;TD width="64"&gt;X&lt;/TD&gt;
&lt;TD width="64"&gt;D&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;antioxidant&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 10 May 2024 11:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927827#M365081</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2024-05-10T11:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Non Repeated letters  positions  in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927828#M365082</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nonduplicates;
    string='Arnold Ziffel';
    length thischar $ 1;
    do pos=1 to length(string);
        thischar=substr(string,pos,1);
        count=countc(string,thischar);
        if count=1 then output;
    end;
    keep pos thischar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code treats capital C as a different letter than lower case c. Your problem description was silent about this issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 12:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927828#M365082</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-10T12:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Non Repeated letters  positions  in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927890#M365107</link>
      <description>&lt;P&gt;A quick comment about the thinking involved with&lt;/P&gt;
&lt;PRE&gt;position_list = cats(position_list, i);&lt;/PRE&gt;
&lt;P&gt;Let's examine a hypothetical resulting position_list value of 12345.... (dots are other digits not germane at this point).&lt;/P&gt;
&lt;P&gt;How do you tell position 1 for the first unique letter and 23 for the second from a position of 12 for the first and 34 for the second?&lt;/P&gt;
&lt;P&gt;If I were contemplating creating such as list I would place a delimiter using the CATX function for example.&lt;/P&gt;
&lt;PRE&gt;position_list = catx(',',position_list, i);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Then we would see 1,23,45... or 12,34,5... and the ambiguity goes away.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any rules about characters other than letters?&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 16:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Non-Repeated-letters-positions-in-a-string/m-p/927890#M365107</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-10T16:53:09Z</dc:date>
    </item>
  </channel>
</rss>

