<?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: Delete if wrds  same in the word not by substr in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132383#M26976</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;My_SAS wrote:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;i want the output if the first,second,third,foruth,fifth and last character and are same.&lt;/P&gt;
&lt;P&gt;output :&lt;/P&gt;
&lt;P&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in the case of 'ccccx1234c"&lt;/P&gt;&lt;P&gt;the first, -&amp;gt; c&lt;/P&gt;&lt;P&gt;second,-&amp;gt; c&lt;/P&gt;&lt;P&gt;third,-&amp;gt; c&lt;/P&gt;&lt;P&gt;foruth-&amp;gt; c&lt;/P&gt;&lt;P&gt;,fifth-&amp;gt; x&lt;/P&gt;&lt;P&gt;last character-&amp;gt; c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They are different . Any other logic are you using ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2012 07:54:40 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-06-06T07:54:40Z</dc:date>
    <item>
      <title>Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132378#M26971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; data l;&lt;BR /&gt;input id $ 1-20;&lt;BR /&gt;cards;&lt;BR /&gt;aaaa1234a&lt;BR /&gt;bbbb1234b&lt;BR /&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I dont want to do by substr(1,1)=substr(2,1)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;i want the output if the first character and last are same&lt;/P&gt;&lt;P&gt;output :&lt;/P&gt;&lt;P&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2012 08:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132378#M26971</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-06-05T08:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132379#M26972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your output example seems inconsistent with your description, I will just go with the latter:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data l;&lt;/P&gt;&lt;P&gt;input id $ 1-20;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;aaaa1234a&lt;/P&gt;&lt;P&gt;bbbb1234b&lt;/P&gt;&lt;P&gt;ccccx1234c&lt;/P&gt;&lt;P&gt;asdf1234b&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set l;&lt;/P&gt;&lt;P&gt;if first(id)=:left(reverse(id));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2012 13:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132379#M26972</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-06-05T13:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132380#M26973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... another idea ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set l;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;where char(id,1) eq char(right(id),20);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2012 14:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132380#M26973</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-06-05T14:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132381#M26974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OR You like Perl Regular Expression :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data l;
input id $ 1-20;
cards;
aaaa1234a
bbbb1234b
ccccx1234c
asdf1234b
;
run;

 
data want;
set l;
where id=prxchange('s/(\S)(.*)(\S)/\3\2\1/o',-1,id);
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 03:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132381#M26974</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-06-06T03:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132382#M26975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sory i have not framed my question properly&lt;/P&gt;&lt;P&gt;this is the req below&lt;/P&gt;&lt;P&gt;data l;&lt;BR /&gt;input id $ 1-20;&lt;BR /&gt;cards;&lt;BR /&gt;aaaa1234a&lt;BR /&gt;bbbb1234b&lt;BR /&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I dont want to do by substr(1,1)=substr(2,1)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;i want the output if the first,second,third,foruth,fifth and last character and are not same.&lt;/P&gt;&lt;P&gt;output :&lt;/P&gt;&lt;P&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 07:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132382#M26975</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-06-06T07:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132383#M26976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;My_SAS wrote:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;i want the output if the first,second,third,foruth,fifth and last character and are same.&lt;/P&gt;
&lt;P&gt;output :&lt;/P&gt;
&lt;P&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in the case of 'ccccx1234c"&lt;/P&gt;&lt;P&gt;the first, -&amp;gt; c&lt;/P&gt;&lt;P&gt;second,-&amp;gt; c&lt;/P&gt;&lt;P&gt;third,-&amp;gt; c&lt;/P&gt;&lt;P&gt;foruth-&amp;gt; c&lt;/P&gt;&lt;P&gt;,fifth-&amp;gt; x&lt;/P&gt;&lt;P&gt;last character-&amp;gt; c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They are different . Any other logic are you using ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 07:54:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132383#M26976</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-06-06T07:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132384#M26977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want the output if the first,second,third,foruth,fifth and last character and are NOT same.&amp;nbsp; &lt;/P&gt;&lt;P&gt;output :&lt;/P&gt;&lt;P&gt;ccccx1234c&lt;BR /&gt;asdf1234b&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 07:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132384#M26977</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-06-06T07:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132385#M26978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry . overlook "NOT"&lt;/P&gt;&lt;P&gt;Oh, I undertand what you mean now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 08:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132385#M26978</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-06-06T08:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132386#M26979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;should check only the characters are same not the numerics&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bbbbb1234b&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bbbbb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b (all the b characters are same in 1,2,3,4,5 and last obs are same)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 08:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132386#M26979</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-06-06T08:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delete if wrds  same in the word not by substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132387#M26980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data l;
input id $ 1-20;
cards;
aaaa1234a
bbbb1234b
ccccx1234c
asdf1234b
;
run;

 
data want(drop=x);
set l;
x=substrn(left(id),1,1);
if not missing (compress(id,x,'d')) ;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 08:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-if-wrds-same-in-the-word-not-by-substr/m-p/132387#M26980</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-06-06T08:26:11Z</dc:date>
    </item>
  </channel>
</rss>

