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 (February 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Feb 2002 12:55:14 -0500
Reply-To:     Mark Casazza <Mark.Casazza@domino1.cuny.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Mark Casazza <Mark.Casazza@domino1.cuny.edu>
Subject:      Re: syntax
Comments: To: "Sidky, Sonya" <Sonya.Sidky@etf.state.wi.us>
In-Reply-To:  <D38E1D249D9D6C4D8032329D7A09CE132C09FB@ETF-EXCHANGE>
Content-Type: text/plain; charset="iso-8859-1"

Hi Sonya,

This does it.

--

data list fixed /code 1-4 (a). begin data 1234 2223 2V25 2X25 2V12 end data.

numeric flag (f1.0).

do if (index(code,"V")>0). compute flag = 1. else if (index(code,"X")>0). compute flag = 2. end if. exe.

--

Mark V. Casazza Director of Academic Information The City University of New York 555 W. 57th St. 16th Floor New York, NY 10019

phone: 212.541.0396 fax: 212.541.0392 email: Mark.Casazza@mail.cuny.edu

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Sidky, Sonya Sent: Friday, February 08, 2002 12:34 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: syntax

Hello SPSSers,

I am trying to write syntax that recodes a variable based on whether a certain string can be found in another variable. Is there a function available that flags cases in which a string expression contains certain characters?

For example, lets say you have the following variable and values:

CODE 1234 2223 2V25 2X25 2V12

How would you write syntax that would recode any case that contains the letter 'V' as number 1 and 'X' as 2 into a new variable?

Thanks,

Sonya


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