Date: Wed, 12 Mar 1997 11:43:44 -0600
Reply-To: "Ronald W. Manley" <JAN7089@VM1.UCC.OKSTATE.EDU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Ronald W. Manley" <JAN7089@VM1.UCC.OKSTATE.EDU>
Organization: Oklahoma State University, Stillwater OK
Subject: Re: separate character variable
Content-Type: text/plain; charset=us-ascii
jerry mcgwin, jr. wrote:
> i am working with a dataset that contains an individual's first, middle and
> last name in one variable (NAME). i would like to separate this one
> variable into its individual components (FNAME, MNAME, LNAME). is there a
> straigtforward way to accomplish this? thanks.
Use x=indexc(NAME,' ') x returns the first occurance of the char
defined in this case I used blank.
Then use FNAME=substr(NAME,1,x) to get the first name and
use REST=substr(NAME,x) to get the rest of the name then
use y=indexc(REST,' ') to get the middle name and so on.
I hope this helps.