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
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
|