<?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: Working with Addresses in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432341#M107075</link>
    <description>&lt;P&gt;Did you run the new code which refers to your data set and your address? It will do that automatically, that's how SAS works by default, it processes all rows within the data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's not working, post your code, log and explain what's not working in detail. Not working isn't informative.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jan 2018 17:03:34 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-01-30T17:03:34Z</dc:date>
    <item>
      <title>Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/431969#M106908</link>
      <description>&lt;P&gt;&lt;SPAN&gt;My data set has the street number, prefix, street name, and suffix all together in a single variable. I am trying to separate the street number from the rest of the address. (For example, I want 3991 3rd ST to read 3991 in one variable and 3rd ST in the next variable.) I know I have to do some sort of formatting language at the first space in the column but am&amp;nbsp;not sure how to do that.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 21:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/431969#M106908</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2018-01-29T21:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/431976#M106911</link>
      <description>&lt;P&gt;You can start with SCAN() but I'd strongly consider doing some searching on LexJansen for some developed code and working off that. This is a non-trivial problem (sadly) and usually PRX is the best approach and the papers will cover topics you didn't mention such as Street vs St vs St. and other things.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 21:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/431976#M106911</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-29T21:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/431979#M106914</link>
      <description>&lt;P&gt;Yes, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;said, it can get quite complex. However, if you're only wanting to separate the number from the rest, you could use something like:&lt;/P&gt;
&lt;PRE&gt;data have;
  informat address $80.;
  input address &amp;amp;;
  cards;
3991 3rd ST
;

data want (drop=_:);
  set have;
  call scan(address,1,_pos,_len);
  street_number=input(substr(address,_pos,_len),8.);
  street=left(substr(address,_len+1));
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 21:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/431979#M106914</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-29T21:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432304#M107056</link>
      <description>&lt;P&gt;I used your code and I was able to separate the street number for the first address in my list. But how would I do it for the entire variable? I have about 30,000 observations.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data palmbeachsales16;
informat own_addr1 $80.;
input own_addr1 &amp;amp;;
cards;
50257 CORKSCREW BLVD
;

data palmbeachaddr16 (drop=_:);
set palmbeachsales16;
call scan(own_addr1,1,_pos,_len);
street_number=input(substr(own_addr1,_pos,_len),8.);
street=left(substr(own_addr1,_len+1));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432304#M107056</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2018-01-30T16:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432307#M107058</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; palmbeachaddr16 &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;drop&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;_:&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;; &lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; palmbeachsales16&lt;SPAN class="token punctuation"&gt;; &amp;lt;- change this to be YOUR data set name;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're using the demo data rather than your own. Change the SET statement to refer to your data set.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:12:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432307#M107058</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-30T16:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432328#M107065</link>
      <description>&lt;P&gt;Like this? But how do I generalize it to all the addresses in the set?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data palmbeachaddr16 (drop=_:);
set palmbeachsales16;
call scan(own_addr1,1,_pos,_len);
street_number=input(substr(own_addr1,_pos,_len),8.);
street=left(substr(own_addr1,_len+1));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432328#M107065</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2018-01-30T16:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432330#M107067</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/158881"&gt;@andrewfau&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Like this? But how do I generalize it to all the addresses in the set?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What do you mean by that? Once you refer to your own address it will extract all the numbers.&amp;nbsp;What are you expecting and what are you getting?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432330#M107067</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-30T16:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432340#M107074</link>
      <description>&lt;P&gt;The example code had the example address in it. I have a dataset with about 30,000 addresses and I am trying to separate the streetnumber from the street name in each to make them separate variables. Is there a way to apply that code to all the addresses in that variable rather than just one?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 17:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432340#M107074</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2018-01-30T17:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432341#M107075</link>
      <description>&lt;P&gt;Did you run the new code which refers to your data set and your address? It will do that automatically, that's how SAS works by default, it processes all rows within the data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's not working, post your code, log and explain what's not working in detail. Not working isn't informative.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 17:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432341#M107075</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-30T17:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432353#M107082</link>
      <description>&lt;P&gt;I figured it out. I was making the simple mistake of not bringing in my whole dataset. Sorry. I'm still new at this. It is working. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 17:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432353#M107082</guid>
      <dc:creator>andrewfau</dc:creator>
      <dc:date>2018-01-30T17:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Addresses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432391#M107097</link>
      <description>&lt;P&gt;You could try regular expressions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data foo;
	infile datalines delimiter=',';
	informat raw $varying1024.;
	input raw $;
	datalines;
3991 3rd ST
;
run;


proc sql;
	select
		prxchange('s/(\d+)(?: )(\w+)/$1/', -1, raw) as house_number
		,prxchange('s/(\d+)(?: )(\w+)/$2/', -1, raw) as street
	from foo;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 18:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Working-with-Addresses/m-p/432391#M107097</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2018-01-30T18:16:56Z</dc:date>
    </item>
  </channel>
</rss>

