LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2001, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 30 Nov 2001 11:43:38 -0500
Reply-To:     Boyd Newlin <bnewlin@INSMED.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Boyd Newlin <bnewlin@INSMED.COM>
Subject:      Re: Parsing a string
Content-Type: text/plain; charset="iso-8859-1"

Thanks for all who have responded but .......

After I worked with it a little more, I should of explained a little better. I'm trying to figure out to search for 2 or more spaces and replace that with a delimeter such as a comma.

-----Original Message----- From: fred.x.gehm@household.com [mailto:fred.x.gehm@household.com] Sent: Friday, November 30, 2001 10:23 AM To: Boyd Newlin Cc: SAS-L@LISTSERV.UGA.EDU Subject: Re: Parsing a string

Boyd:

Try this:

if compbl(string) = string then var1=string; else do; var1 = scan(string,1,' '); var2 = scan(string,2,' '); end;

The code above assumes that there are two variables which are seperated by one or more spaces.

Fred

Boyd Newlin To: SAS-L@LISTSERV.UGA.EDU

<bnewlin@INSMED.C cc:

OM> Subject: Parsing a string

Sent by: "SAS(r)

Discussion"

<SAS-L@LISTSERV.U

GA.EDU>

11/30/2001 09:12

AM

Please respond to

Boyd Newlin

I hope this is simple but I can't seem to see a solution.

I have a string .... see the below:

string = word1 word2 or string = word1 word2

I want word1 and word2 in one variable called x if the words are separated by only one space otherwise if separated by more than 1 space then variable x will only contain word1 and variable y will contain word2.

Understand what I'm saying?

Thanks

Boyd Newlin Senior Programmer Analyst Insmed Incorporated Biostatistics and Programming P.O. Box 2400 Glen Allen, VA 23058 804-565.3040 fax 804-565.3511 bnewlin@insmed.com


Back to: Top of message | Previous page | Main SAS-L page