<?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 filter record second position of 'a' letter from last onwards by using like operator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881719#M348406</link>
    <description>&lt;P&gt;I do not think LIKE can do that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where substr(name,length(name)-1,1) = 'a';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also use the PRX* functions.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jun 2023 14:01:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-06-21T14:01:27Z</dc:date>
    <item>
      <title>how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881716#M348405</link>
      <description>&lt;P&gt;data ex1;&lt;BR /&gt;set sashelp.class ;&lt;BR /&gt;where name like '%a_' ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;Barbara&lt;BR /&gt;Thomas&lt;BR /&gt;William&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if I use the above 3 records coming but 'Barbara' value should come from last to second position 'r' letter is there . remaining 2 values correct 'Thomas''William'&lt;BR /&gt;how to pick by using like operator only?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 13:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881716#M348405</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2023-06-21T13:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881719#M348406</link>
      <description>&lt;P&gt;I do not think LIKE can do that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where substr(name,length(name)-1,1) = 'a';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also use the PRX* functions.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 14:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881719#M348406</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-21T14:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881720#M348407</link>
      <description>Thank you for your answer but I have to use like operator only</description>
      <pubDate>Wed, 21 Jun 2023 14:03:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881720#M348407</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2023-06-21T14:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881727#M348408</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data ex1;&lt;BR /&gt;set sashelp.class ;&lt;BR /&gt;where name like '%a_' ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;Barbara&lt;BR /&gt;Thomas&lt;BR /&gt;William&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if I use the above 3 records coming but 'Barbara' value should come from last to second position 'r' letter is there . remaining 2 values correct 'Thomas''William'&lt;BR /&gt;how to pick by using like operator only?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Like matches&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-details"&gt;
&lt;DIV id="n17nl6tm5szhcqn14cqda9vk8riy" class="xis-subTopic"&gt;
&lt;DIV id="n1pnfs6fx0flyyn1ol58xr9qqfvs" class="xis-topicContent"&gt;
&lt;DIV id="n0s5b7vij1nyyhn12x0emza2aw9i" class="xis-paragraph"&gt;Patterns consist of three classes of characters:
&lt;DIV class="xis-listTermDef"&gt;
&lt;DIV id="p1f5i4u9s30jtcn1uikp2g1z529s" class="xis-termDefPair"&gt;
&lt;DIV class="xis-term"&gt;underscore (_)&lt;/DIV&gt;
&lt;DIV class="xis-definition"&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;matches any single character.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="n1qorq247xm3kyn1k15e1pxfjbph" class="xis-termDefPair"&gt;
&lt;DIV class="xis-term"&gt;percent sign (%)&lt;/DIV&gt;
&lt;DIV class="xis-definition"&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;matches any sequence of zero or more characters.&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-details"&gt;
&lt;DIV id="n17nl6tm5szhcqn14cqda9vk8riy" class="xis-subTopic"&gt;
&lt;DIV id="n1pnfs6fx0flyyn1ol58xr9qqfvs" class="xis-topicContent"&gt;
&lt;DIV id="n0s5b7vij1nyyhn12x0emza2aw9i" class="xis-paragraph"&gt;
&lt;DIV class="xis-listTermDef"&gt;
&lt;DIV id="n13uxjxym33a42n1n6wrtwz0jzu4" class="xis-termDefPair"&gt;
&lt;DIV class="xis-term"&gt;any other character&lt;/DIV&gt;
&lt;DIV class="xis-definition"&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;matches that character&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So saying that you "have to use like" means that you do not actually care about 2nd to last position because Like doesn't use any&amp;nbsp; specific position.&lt;/P&gt;
&lt;P&gt;PRX functions,&lt;/P&gt;
&lt;P&gt;or Substr with the Length function to start searching at the second to last position, but not Like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 14:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881727#M348408</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-21T14:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881728#M348409</link>
      <description>&lt;P&gt;How about&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;like '%a_ '&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Mind that this will match any "word" where the next-to-last character is an "a", so the string&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"Xxxax yyyyy"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will also match. And in the case of&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length x $5;
x = "xxxax";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it won't match, as there is no space left in the variable for blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The regular expression functions are&amp;nbsp;&lt;STRONG&gt;MUCH&lt;/STRONG&gt; better at detecting end of words under all circumstances.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is an exercise, it is a BAD exercise, and you need to tell your instructor and classmates.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 15:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881728#M348409</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-21T15:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881739#M348412</link>
      <description>It doesn't look like your requirement isn't consistent. For the first record you want 'ra' and for the next two, Thomas/William you want s/m or nothing?&lt;BR /&gt;&lt;BR /&gt;What is the general rule?&lt;BR /&gt;&lt;BR /&gt;like %a_ looks for a_ but you have no underscore so that should never match. &lt;BR /&gt;</description>
      <pubDate>Wed, 21 Jun 2023 15:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881739#M348412</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-21T15:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881740#M348413</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ex1;
set sashelp.class ;
where strip(name) like '%a_' ;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm assuming "Barabara" has a trailing blank, and the wildcard (_) picking this blank as a single character, so the last letter 'a' is being considered as the second letter backwards.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 15:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881740#M348413</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2023-06-21T15:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter record second position of 'a' letter from last onwards by using like operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881746#M348417</link>
      <description>data ex1;&lt;BR /&gt;set sashelp.class ;&lt;BR /&gt;where name like '%a_ ' ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;If you want it at the end, add a space at the end?</description>
      <pubDate>Wed, 21 Jun 2023 16:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-record-second-position-of-a-letter-from-last/m-p/881746#M348417</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-21T16:33:30Z</dc:date>
    </item>
  </channel>
</rss>

