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 (May 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 1 May 2003 09:23:52 -0400
Reply-To:   Mahbub Khandoker <Mahbub_Khandoker@camh.net>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Mahbub Khandoker <Mahbub_Khandoker@camh.net>
Subject:   Re: creating 3 variable out of string
Comments:   To: Muir Houston <hous-ca0@wpmail.paisley.ac.uk>
Content-Type:   text/plain; charset="iso-8859-1"

Hi Muir, Hope this is what you need.

DATA LIST free/ course_c (a14). Begin data SSSVMQ/YY3/9XE SSSVMP/YY2/8XE SSSVML/YY4/7XE End data.

STRING course_n (A6). COMPUTE course_n=LTRIM(SUBSTR(course_c,INDEX(course_n,',')+1)). EXECUTE.

STRING year (A3). COMPUTE year=LTRIM(SUBSTR(course_c,INDEX(year,',')+8)). EXECUTE.

STRING c_year (A3). COMPUTE c_year=LTRIM(SUBSTR(course_c,INDEX(c_year,',')+12)). EXECUTE.

I developed it with the help of Raynald Levesque's previous posting. Thanks. Mahbub Khandoker Analyst IMG-Decision Support Centre for Addiction and Mental Health 1001 Queen Street West Toronto, Ontario, Canada M6J 1H4 Phone: 416 535 8501 X 6534

-----Original Message----- From: Muir Houston [mailto:hous-ca0@wpmail.paisley.ac.uk] Sent: May 1, 2003 6:12 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: creating 3 variable out of string

HI listers, I have been looking for some syntax which allows me to recode a string variable into three separate variables depending on part of the string my variable is named course_c and is formatted like so: example - SSSVMQ/YY3/9XE i would like to create 3 variables from each course code

the first part of the string (to the first /) is course name [eg SSSVMQ]

the second part of the string (between the two slashes) is the year of enrolment [eg YY3]

and the third part (after the last slash) is the serial year of the course ie students can enrol directly into advanced years [eg 9XE]

i had a look at some previous postings but the recent ones seemed to remove parts of the string itself to create new variable rather than what i am after and as a relative novice syntaxer unable without pointers to figure it out myself

TIA muir houston

Legal disclaimer --------------------------

The information transmitted is the property of the University of Paisley and is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Statements and opinions expressed in this e-mail may not represent those of the company. Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer.

--------------------------


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