LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 17 Nov 2003 10:07:12 -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: removing " character from string variable
Comments: To: Paul Mcgeoghan <Mcgeoghan@Cardiff.ac.uk>
In-Reply-To:  <sfb8e099.086@MAINCF1P.cf.ac.uk>
Content-Type: text/plain; charset="us-ascii"

Hi Paul,

Here is a variation on some "find/replace" syntax that does what you want.

-- DATA LIST fixed/v1 1-5(a). BEGIN DATA. "ABC" "A" "B" END DATA. LIST.

DO IF (INDEX(v1,'"')>0). . LOOP. . COMPUTE v1 = CONCAT(SUBSTR(v1,1,INDEX(v1,'"')-1),"", SUBSTR(v1,INDEX(v1,'"')+1, LENGTH(v1)-INDEX(v1,'"'))). . END LOOP IF (INDEX(v1,'"')=0). END IF. EXE. LIST. --

Mark Casazza Director of Academic Information The City University of New York 555 West 57th St. Suite 1240 New York, NY 10019

phone: 212.541.0396 fax: 212.541.0372 mark.casazza@mail.cuny.edu

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Paul Mcgeoghan Sent: Monday, November 17, 2003 9:52 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: removing " character from string variable

Hi,

If I have data which starts and ends with ", how I can remove "?

"ABC" "A" "B"

I have tried the following which removes the " from the left as does LTRIM.

COMPUTE COMPANY = SUBSTR(company,2,LEN(RTRIM(company))-1) . EXECUTE .

I can't seem to remove it from the right though. Thanks, Paul

================== Paul McGeoghan, Application support specialist (Statistics and Databases), Information Services, Cardiff University. Tel. 02920 (875035).


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