<?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: How to remove last repeated same word more then once? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415431#M101888</link>
    <description>&lt;P&gt;Assumes your test data reflects your data!:&lt;/P&gt;
&lt;PRE&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; name=scan(a,1);&lt;BR /&gt; other=scan(a,2,"%");&lt;BR /&gt;run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Nov 2017 09:32:00 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-11-22T09:32:00Z</dc:date>
    <item>
      <title>How to remove last repeated same word more then once?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415373#M101858</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;input a $ 30.;&lt;BR /&gt;cards;&lt;BR /&gt;abc %ak% %ak%&lt;BR /&gt;hjk %kl% %kl%&lt;BR /&gt;hygllllkjk %ko% %ko%&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Required Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;abc&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;%ak%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;hjk&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;%kl%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hygllllkjk&amp;nbsp; &amp;nbsp; %ko%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 04:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415373#M101858</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2017-11-22T04:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove last repeated same word more then once?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415376#M101860</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;
&lt;PRE&gt;data have;
  informat a $30.;
  length b $30;
input a &amp;amp;;
cards;
abc %ak% %ak%
hjk %kl% %kl%
hygllllkjk %ko% %ko%
;
run;

data want (drop=i j);
  set have;
  array test(999) $ _temporary_;
  i=1;
  j=0;
  do while (scan(a,i,' ') ne '');
    if scan(a,i,' ') not in test then do;
      j+1;
      test(j)=scan(a,i,' ');
    end;
    i+1;
  end;
  do i=1 to j;
    b=catx(' ',b,test(i));
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 05:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415376#M101860</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-11-22T05:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove last repeated same word more then once?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415431#M101888</link>
      <description>&lt;P&gt;Assumes your test data reflects your data!:&lt;/P&gt;
&lt;PRE&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; name=scan(a,1);&lt;BR /&gt; other=scan(a,2,"%");&lt;BR /&gt;run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 09:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415431#M101888</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-22T09:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove last repeated same word more then once?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415489#M101903</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a $30.;
cards;
abc %ak% %ak%
hjk %kl% %kl%
hygllllkjk %ko% %ko%
hygllllkjk %ko%
;
run;

data want;
 set have;
 want=prxchange('s/(\s+\S+)(\1)+$/\1/',-1,strip(a));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 12:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-last-repeated-same-word-more-then-once/m-p/415489#M101903</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-11-22T12:36:37Z</dc:date>
    </item>
  </channel>
</rss>

