<?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: last word from right in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367573#M87545</link>
    <description>&lt;P&gt;something like this&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if prxmatch("m/\s.{3}$/oi",trim(addr_ln_1))&amp;gt; 0 then cntry='CAN';&lt;BR /&gt; else cntry='US';&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 01:51:14 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2017-06-16T01:51:14Z</dc:date>
    <item>
      <title>last word from right</title>
      <link>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367569#M87541</link>
      <description>&lt;P&gt;&amp;nbsp;Hi,&amp;nbsp; I'm trying to find if there is a space after the last 3 digits then it's a canadian address otherwise it's US.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;field&lt;/P&gt;
&lt;P&gt;23 Yonge st.&amp;nbsp; M4H 6F7&lt;/P&gt;
&lt;P&gt;23 Yonge st. 902910&lt;/P&gt;
&lt;P&gt;827 Bla Bla Rd. T7G 7K2&lt;/P&gt;
&lt;P&gt;Sammy Rd. 38278&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where there is a postal code I'd say Canadian and 2 and 4 are US.. So I figured if there is a space after the last 3 digits from the right then it's&amp;nbsp; Can, otherwise US.&lt;/P&gt;
&lt;P&gt;Thnks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 01:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367569#M87541</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2017-06-16T01:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: last word from right</title>
      <link>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367570#M87542</link>
      <description>&lt;P&gt;Please try perl as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if prxmatch('m/\s\d\w\d$/',strip(field)) then flag='Can';
else flag='US';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2017 01:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367570#M87542</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-16T01:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: last word from right</title>
      <link>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367571#M87543</link>
      <description>&lt;P&gt;You could use variations of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if length(scan(ADDRESS,-1)) in (3,6) then COUNTRY='CANADA';&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 02:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367571#M87543</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-16T02:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: last word from right</title>
      <link>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367572#M87544</link>
      <description>&lt;P&gt;A different&amp;nbsp;option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Use COUNTW to determine the number of words&lt;/P&gt;
&lt;P&gt;2. Find last word&lt;/P&gt;
&lt;P&gt;3. If Length = 5 then it's US, otherwise, it's CAN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Perl is more efficient though&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length country $8.;

n_words = countw(text);
last_word = scan(text, n_words);

if length(last_word)=3 then country = 'CAN';
else if length(last_word)=5 then country='US';
else country='CHECKME';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2017 01:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367572#M87544</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-16T01:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: last word from right</title>
      <link>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367573#M87545</link>
      <description>&lt;P&gt;something like this&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if prxmatch("m/\s.{3}$/oi",trim(addr_ln_1))&amp;gt; 0 then cntry='CAN';&lt;BR /&gt; else cntry='US';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 01:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/last-word-from-right/m-p/367573#M87545</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-16T01:51:14Z</dc:date>
    </item>
  </channel>
</rss>

