<?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: pulling a two-word street name out of an address in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706245#M216752</link>
    <description>&lt;P&gt;If you have many addresses I promise that no single code will work for all of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of my datasets I was supposed to geocode had an "address" field that users entered information other than the address because that appeared at the top of screens or print outs. So I had to clean out stuff like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Address= "See the woman in the back apartment&amp;nbsp; 4433 Some actual Street".&lt;/P&gt;
&lt;P&gt;Or rural addresses like "Intersection Baseline Road and County Rd 33".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck and have fun.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2020 08:41:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-12-16T08:41:29Z</dc:date>
    <item>
      <title>pulling a two-word street name out of an address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706212#M216733</link>
      <description>&lt;DIV&gt;I'm trying to create a function that pulls the street name (whether one or two or three words) out of an address...to get it to pull in anything following the street number...and i'm stuck...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;DATA work.practice;&lt;/DIV&gt;&lt;DIV&gt;Address = '44 Bird Street';&lt;/DIV&gt;&lt;DIV&gt;StreetName = SUBSTR(SCAN(ADDRESS,2), ANYSPACE(ADDRESS)));&lt;/DIV&gt;&lt;DIV&gt;RUN;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This doesn't work at all...don't know where to go with it. &amp;nbsp;Thanks!&lt;/DIV&gt;</description>
      <pubDate>Wed, 16 Dec 2020 05:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706212#M216733</guid>
      <dc:creator>taylormccormick</dc:creator>
      <dc:date>2020-12-16T05:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: pulling a two-word street name out of an address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706225#M216740</link>
      <description>&lt;P&gt;Have you checked what "SCAN(ADDRESS,2)" returns?&lt;/P&gt;
&lt;LI-SPOILER&gt;it returns only "Bird"&lt;/LI-SPOILER&gt;
&lt;P&gt;Try something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length StreetName $ 50;
StreetName = substr(Address, anyalpha(Address));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Dec 2020 06:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706225#M216740</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-12-16T06:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: pulling a two-word street name out of an address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706245#M216752</link>
      <description>&lt;P&gt;If you have many addresses I promise that no single code will work for all of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of my datasets I was supposed to geocode had an "address" field that users entered information other than the address because that appeared at the top of screens or print outs. So I had to clean out stuff like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Address= "See the woman in the back apartment&amp;nbsp; 4433 Some actual Street".&lt;/P&gt;
&lt;P&gt;Or rural addresses like "Intersection Baseline Road and County Rd 33".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck and have fun.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 08:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706245#M216752</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-16T08:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: pulling a two-word street name out of an address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706583#M216876</link>
      <description>&lt;P&gt;One possibility is to use Pearl regular expressions. E.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  Address = '44 Bird Street';
  PrxID=PrxParse('/\d+\s+(.*)/');
  if PrxMatch(PrxID,Address) then
    StreetName=PrxPosN(PrxID,1,Address);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This function just finds one or more digits ("\d+"), followed by one or more blanks ("\s+"), and puts the rest of the string into a capture buffer ("(.*)"), the contents of which is returned by the PrxPosN function.&lt;/P&gt;
&lt;P&gt;You will probably find that more sophistication is needed (which is why I suggest that you get into PRX functions), but this is a start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 10:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-a-two-word-street-name-out-of-an-address/m-p/706583#M216876</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-12-17T10:50:22Z</dc:date>
    </item>
  </channel>
</rss>

