removing single and double quotes from string variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

removing single and double quotes from string variable

Biblin, Janet, BHCS

Hello

 

Does anyone have some good syntax for removing single and double quotes from string variables?

I want to keep the rest of the string and would be happy enough to replace the quote marks with blank space

(I doubt it matters, but the quotes don’t always come in pairs).

 

Thanks

 

Janet

 

Reply | Threaded
Open this post in threaded view
|

Re: removing single and double quotes from string variable

Albert-Jan Roskam
Hi,

string cleaned (a100).
compute cleaned = replace(replace(originalvar, '"', ' '), "'", " ").

Untested, but I think it'll do the trick! Replace 'a100' by a width of your choice.

Cheers!!
Albert-Jan

--- On Thu, 7/30/09, Biblin, Janet, BHCS <[hidden email]> wrote:

> From: Biblin, Janet, BHCS <[hidden email]>
> Subject: removing single and double quotes from string variable
> To: [hidden email]
> Date: Thursday, July 30, 2009, 4:09 AM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hello
>
>
>
> �
>
> Does anyone have
> some good syntax for removing single and
> double quotes from string variables?
>
> I want to keep
> the rest of the string and would be happy
> enough to replace the quote marks with blank
> space
>
> (I doubt it
> matters, but the quotes don’t always come
> in pairs).
>
>
> �
>
> Thanks
>
>
>
> �
>
> Janet
>
>
>
> �
>
>
>
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD