Date: Mon, 15 Sep 2008 18:08:34 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Extracting data from a string to populate a new variable
Is there a chance that the solution might not require string searches? For
example, does the first comma always represent a second address line?
If so, possibly something like the following might suffice:
input address $50.;
123 Main St., 8th Floor
222 8th St.
455 8th St., appt 9
if index(address,",") gt 0 then do;
On Mon, 15 Sep 2008 13:59:55 -0700, RYan <donnelly.ryan.m@GMAIL.COM> wrote:
>Hello all you SAS-L'ers...here's my dilema, I hope you can help.
>I have some address data that needs to get cut up and put into
>different variables, not just one big address variable. Specifically,
>I have addresses like "123 Main St. 8th Floor" where I need to parse
>out the "8th Floor" portion and put it into a new variable.
>So far I've identified all the records with the key phrase "8th" or
>"Eight Floor" using the prxmatch function. However, I haven't been
>able to devise a way to tell SAS to take that info and populate a new
>variable with that string. I thought of using the substr function
>however, their location in the string is not constant.
>Your help is greatly appreciated and I thank you in advance.
>All the best,