<?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 read from end of string? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210317#M52043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try INDEX() function to find the location of the first instance of a numeric character preceded by a blank (including the blank will prevent you from reading Canadian postal codes that begin with a letter) in your string and then nest it in SUBSTRN() function to read 5 characters to the right of the first number.&amp;nbsp; Finally, sounds like you'll want to nest both of the first two in the INPUT() function to output a number rather than a character string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Mar 2015 17:55:33 GMT</pubDate>
    <dc:creator>Haris</dc:creator>
    <dc:date>2015-03-25T17:55:33Z</dc:date>
    <item>
      <title>How to read from end of string?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210316#M52042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I have a variable with different record lengths. I am trying to find out if i can read from the end of the string. Also, If any of the "want" is alphanumeric, then DELETE. I want only US based Zip, not canadian postal code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Have&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Want&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;WARREN MI 48091-3241&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48091&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;BLOOMFIELD MI 48304-2916&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48304&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;SAINT CLAIR SHORES MI 48082-1158&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48082&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;HUNTINGTON WOODS MI 48070&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48070&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;MACOMB MI 48042-2398&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48042&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;HUNTINGTN WDS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , MI 480700000&lt;/TD&gt;&lt;TD&gt;48070&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 17:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210316#M52042</guid>
      <dc:creator>gobejo</dc:creator>
      <dc:date>2015-03-25T17:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from end of string?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210317#M52043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try INDEX() function to find the location of the first instance of a numeric character preceded by a blank (including the blank will prevent you from reading Canadian postal codes that begin with a letter) in your string and then nest it in SUBSTRN() function to read 5 characters to the right of the first number.&amp;nbsp; Finally, sounds like you'll want to nest both of the first two in the INPUT() function to output a number rather than a character string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 17:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210317#M52043</guid>
      <dc:creator>Haris</dc:creator>
      <dc:date>2015-03-25T17:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from end of string?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210318#M52044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; str &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$100.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=prxchange(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'s/(^\D+)(\b\d{5})(.+)/$2/io'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,-&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, str);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;WARREN MI 48091-3241 &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;BLOOMFIELD MI 48304-2916&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;SAINT CLAIR SHORES MI 48082-1158&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;HUNTINGTON WOODS MI 48070&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;MACOMB MI 48042-2398 &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;HUNTINGTN WDS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , MI 480700000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 18:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210318#M52044</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-03-25T18:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to read from end of string?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210319#M52045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;

data test;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile cards truncover;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input str $100.;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length num $ 5;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=scan(str,-1,' ');
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cards;
WARREN MI 48091-3241
BLOOMFIELD MI 48304-2916&amp;nbsp; 
SAINT CLAIR SHORES MI 48082-1158&amp;nbsp;&amp;nbsp;&amp;nbsp; 
HUNTINGTON WOODS MI 48070 
MACOMB MI 48042-2398
HUNTINGTN WDS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , MI 480700000
;
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;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Mar 2015 13:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-read-from-end-of-string/m-p/210319#M52045</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-26T13:25:40Z</dc:date>
    </item>
  </channel>
</rss>

