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 (June 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 10 Jun 2003 11:13:44 -0500
Reply-To:     RC Intrieri <RC-Intrieri@wiu.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         RC Intrieri <RC-Intrieri@wiu.edu>
Subject:      Parsing Text
Content-Type: text/plain; charset="us-ascii"; format=flowed

Dear Listers,

I have a series of names that I am trying to effectively separate. The names include last, first and middle separated by spaces but the separators could also be commas. I have written a sample syntax program to do the job but I wondered if anyone had any ideas about how to make it make it more efficient and also to remove a variable "name5" before the syntax terminates.

Here is the code I used: ************************************************************************************ DATA LIST FIXED /name 1-25 (A). BEGIN DATA Doe John C Poppins Mary D Joel Billy N Pan Peter Piper Reindeer Rudolph R END DATA. LIST.

STRING name5 (A25). STRING LNAME (A15). STRING FNAME (A15). STRING mi (A8).

*1. To delete the " " and everything to the right. COMPUTE LNAME=SUBSTR(name,1,INDEX(name," ")-1). LIST name lname.

*2. To delete the " " and everything to the LEFT. COMPUTE name5=SUBSTR(name,INDEX(name," ")+1). LIST name lname name5 .

*3. To delete the " " and everything to the right. COMPUTE Fname=SUBSTR(name5,1,INDEX(name5," ")-1). LIST lname fname name5.

*4. To delete the " " and everything to the LEFT. COMPUTE mi=SUBSTR(name5,INDEX(name5," ")+1). LIST name lname fname mi name5.

**************************************************************************************************** any ideas or help would be appreciated.

Bob Intrieri

Robert C. Intrieri, PhD Office (309) 298-1336 Department of Psychology Fax (309) 298-2179 Western Illinois University E-mail RC-Intrieri@wiu.edu 1 University Circle Macomb IL 61455-1390


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