Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Help on double or single quote search in a String


From   "David Harrison" <David@icnarc.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Help on double or single quote search in a String
Date   Tue, 26 Oct 2004 17:13:14 +0100

Use compound double quotes - ie `" for open quote and "' for close quote. So the string containing the double quote character is written as `"""'

e.g.

. di index(`"string with " quotes"',`"""')
13

David
david@icnarc.org

-----Original Message-----
From: MITRA PINAKI (MAR1PXM) [mailto:mar1pxm@ups.com]
Sent: 26 October 2004 16:54
To: statalist@hsphsun2.harvard.edu
Subject: st: Help on double or single quote search in a String


Hello List,

    I have a string variable which has double quotes and/or single quotes in
some of the values and I would like to delete and generate a new variable.

For example,
Old Name			New Name
Brad  Allred"s		Brad  Allreds
STEVEN" KROFF'		STEVEN KROFF

How can I put the double quote <"> and/or single quote <'> in the index
string function to search for and delete it? I can't figure out the trick to
search for quotes in a string variable; I get the error message "too few
quotes" in all my attempts. Can anyone please help me with this?

Thank you,
Pinaki

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index