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 (January 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 26 Jan 2005 11:55:17 +0100
Reply-To:     Spousta Jan <JSpousta@CSAS.CZ>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Spousta Jan <JSpousta@CSAS.CZ>
Subject:      Re: Replacing a character
Comments: To: lars.h.johansson@vattenfall.com
Content-Type: text/plain; charset="iso-8859-1"

Hi Lars, try this:

if (index(My_Variable,">")>0) substr(My_Variable,index(My_Variable,">"),1) = "-". exe.

Jan

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of <Lars Johansson> Sent: Wednesday, January 26, 2005 10:46 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Replacing a character

How do I replace one character with another in every case for a variable? Say my variable is "My_Variable" and the first case contains "Oslo>Copenhagen" etc. and I want to replace ">" with "-".

My_Variable Oslo>Copenhagen Copenhagen>Oslo Oslo>London Copenhagen>Hamburg

should become

My_Variable Oslo-Copenhagen Copenhagen-Oslo Oslo-London Copenhagen-Hamburg

Thanks in advance, Lars Johansson


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