<?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: Parting numbers and letters in one cell from eachother in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50940#M13914</link>
    <description>I solved it in VBA.&lt;BR /&gt;
&lt;BR /&gt;
But still looking for a SAS code!

Message was edited by: TMorville</description>
    <pubDate>Thu, 16 Dec 2010 10:37:03 GMT</pubDate>
    <dc:creator>TMorville</dc:creator>
    <dc:date>2010-12-16T10:37:03Z</dc:date>
    <item>
      <title>Parting numbers and letters in one cell from eachother</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50939#M13913</link>
      <description>I've googled it, and looked through the forums, but with no luck.&lt;BR /&gt;
&lt;BR /&gt;
I think that i did this once, but i simply can't make anything work right now!&lt;BR /&gt;
&lt;BR /&gt;
I have a adress cell, but with streetname and number in one cell. I would like SAS to recognize the number in the cell, and remove it to a new cell. Or simply create two new colums, one with characters, and one with numbes.&lt;BR /&gt;
&lt;BR /&gt;
Thanks, and merry Christmas!</description>
      <pubDate>Thu, 16 Dec 2010 10:03:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50939#M13913</guid>
      <dc:creator>TMorville</dc:creator>
      <dc:date>2010-12-16T10:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Parting numbers and letters in one cell from eachother</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50940#M13914</link>
      <description>I solved it in VBA.&lt;BR /&gt;
&lt;BR /&gt;
But still looking for a SAS code!

Message was edited by: TMorville</description>
      <pubDate>Thu, 16 Dec 2010 10:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50940#M13914</guid>
      <dc:creator>TMorville</dc:creator>
      <dc:date>2010-12-16T10:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Parting numbers and letters in one cell from eachother</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50941#M13915</link>
      <description>Hi:&lt;BR /&gt;
  I would imagine that some combination of SCAN, SUBSTR, ANYDIGIT, ANYALPHA, etc, etc functions would be useful. But, it seems to me that quite a bit about your data needs to be explained. For example, are all the addresses VERY regular:&lt;BR /&gt;
&lt;B&gt;&lt;BR /&gt;
1234 Sesame St.&lt;BR /&gt;
98765 Chocolate Way&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
    &lt;BR /&gt;
where the number ALWAYS comes first??? Or, could you have more irregular addresses:&lt;BR /&gt;
&lt;B&gt;&lt;BR /&gt;
North 1234 Grouch Lane&lt;BR /&gt;
98765-A 34th St, South&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
For the "regular" data, getting the first chunk, if it's always the number is going to be a simple SCAN. But, for the "irregular" data, do you want to see the 1234 and then "North Grouch Lane" as one string or do you want to see 1234, then one string for the prefix "North" and a second variable for street name of "Grouch Lane".&lt;BR /&gt;
 &lt;BR /&gt;
What about 98765-A?? Seems like an apartment or a multi-unit building -- would you want the "-A" to be part of the "98765" (in which case, you have a field that cannot be just a number). Or, what about 34th -- a function would find the number 34, but the 34 is part of the street designation.&lt;BR /&gt;
 &lt;BR /&gt;
You originally said you wanted "SAS to recognize the number in the cell, and remove it to a new cell. Or simply create two new colums, one with characters, and one with numbers." It seems to me that without more information about the data and what to do in irregular situations, this is a hard one to help with beyond pointing you in the general direction of the character functions for parsing, splitting and extracting.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 16 Dec 2010 16:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50941#M13915</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-12-16T16:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Parting numbers and letters in one cell from eachother</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50942#M13916</link>
      <description>Hi.&lt;BR /&gt;
Cynthia ,I think Function COMPRESS() is more powerful and useful than what you refer to.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
infile datalines truncover;&lt;BR /&gt;
input address $100.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1234 Sesame St.&lt;BR /&gt;
98765 Chocolate Way&lt;BR /&gt;
North 1234 Grouch Lane&lt;BR /&gt;
98765-A 34th St, South&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
data address;&lt;BR /&gt;
 set temp;&lt;BR /&gt;
 only_digit=compress(address,,'ap');&lt;BR /&gt;
 only_char_punctuation=compress(address,,'d');&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Fri, 17 Dec 2010 01:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50942#M13916</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-17T01:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Parting numbers and letters in one cell from eachother</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50943#M13917</link>
      <description>I tryed the compress func, and it works with a bit of fiddleing around.&lt;BR /&gt;
&lt;BR /&gt;
The adresses are all messed up. Some with . others with , - and so forth. &lt;BR /&gt;
&lt;BR /&gt;
It could look like&lt;BR /&gt;
&lt;BR /&gt;
Milky Way 52, 5 t.h.&lt;BR /&gt;
MilkyWay 52-5 th&lt;BR /&gt;
Milky Way 5 th. 2 v&lt;BR /&gt;
&lt;BR /&gt;
And so forth. But i solved it in an OK manner.</description>
      <pubDate>Fri, 17 Dec 2010 12:55:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50943#M13917</guid>
      <dc:creator>TMorville</dc:creator>
      <dc:date>2010-12-17T12:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Parting numbers and letters in one cell from eachother</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50944#M13918</link>
      <description>Yes, COMPRESS would work for simple addresses (such as in my first example), but would be especially problematic for this address:&lt;BR /&gt;
&lt;B&gt;&lt;BR /&gt;
98765-A 34th St, South&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
If you look at observation 4 in your output from PROC PRINT, you will see that the "converted" result for the above address is:&lt;BR /&gt;
[pre]&lt;BR /&gt;
                                 only_       only_char_&lt;BR /&gt;
Obs           address            digit       punctuation&lt;BR /&gt;
&lt;BR /&gt;
4     98765-A 34th St, South    98765 34    -A th St, South&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
And my guess is that "-A th St, South" instead of "34th St, South" would be an unacceptable result that requires a bit more thought, conditional logic and coding. &lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 17 Dec 2010 15:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parting-numbers-and-letters-in-one-cell-from-eachother/m-p/50944#M13918</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-12-17T15:26:49Z</dc:date>
    </item>
  </channel>
</rss>

