How to Replace a single quote

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

How to Replace a single quote

Ty Noonan
Is there a way to remove a single quote ' from string data.  SPSS does not seem to like single quotes in the replace function.

Ty Noonan







____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
Reply | Threaded
Open this post in threaded view
|

Re: How to Replace a single quote

Richard Ristow
At 08:37 PM 6/28/2007, Ty Noonan wrote:

>Is there a way to remove a single quote ' from string data.  SPSS does
>not seem to like single quotes in the replace function.

Are you running into the problem of declaring a constant whose value is
a single quote? Not tested, but

COMPUTE <target> = REPLACE(<source>,"'",<replacement>).

should work. If it doesn't, maybe re-post, with the syntax you're
using, test data, any error or warning messages, and what you hoped for
vs. what you got.

-Very good luck,
  Richard
Reply | Threaded
Open this post in threaded view
|

AW: How to Replace a single quote

la volta statistics
In reply to this post by Ty Noonan
The following two codes work for me.
Hoe that helps.
Christian

* First solution.
****************.
Data List free / cases (A20).
Begin data
"single quote'"
"single 'quote"
"single' quote"
"s'ingle quote"
"'single quote"
"'"
"'single' 'quote'"
"'"
End data.
List.

COMPUTE cases = REPLACE(cases,"'","") .
List.

* second solution.
*****************.
Data List free / cases (A20).
Begin data
"single quote'"
"single 'quote"
"single' quote"
"s'ingle quote"
"'single quote"
"'"
"'single' 'quote'"
"'"
End data.
List.


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




*******************************
la volta statistics
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
Ch-8006 Zurich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email: mailto:[hidden email]
internet: http://www.lavolta.ch/


-----Ursprungliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]]Im Auftrag von
Ty Noonan
Gesendet: Freitag, 29. Juni 2007 02:37
An: [hidden email]
Betreff: How to Replace a single quote


Is there a way to remove a single quote ' from string data.  SPSS does not
seem to like single quotes in the replace function.

Ty Noonan







Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
Reply | Threaded
Open this post in threaded view
|

Query: Weighted Least Squares Regression in SPSS

Jamie Burnett-3
Hi, can someone please help?

A lot of the time I work with observational data collected from surveys.
Due to non-response and unequal probabilities of selection the data is
weighted.

When I run a regression model in SPSS I was wondering whether 'best
practice' was to run a WLS regression model or simply weight the data
before running a standard regression model. As I understood it the WLS
regression in SPSS is used to combat the effects of heteroscedasicity
but is it equally appropriate to use it for sample design weights?

Many Thanks


Jamie





============================
This e-mail and all attachments it may contain is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Ipsos MORI and its associated companies. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this e-mail is strictly prohibited. Please contact the sender if you have received this e-mail in error.

Market & Opinion Research International Ltd , Registered in England and Wales No. 948470 , 79-81 Borough Road , London SE1 1FY, United Kingdom, Email: [hidden email]
============================