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

st: Re: how to destring variables containing char " ' "


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: how to destring variables containing char " ' "
Date   Wed, 14 Apr 2004 13:39:30 -0400

This issue has come up on the list before and I think the solution involved
using subinstr to delete the single quote characters -- you may need to
enclose them in compound double quotes in the command :

gen mystring2=subinstr(mystring,`"'"',"",.)
destring mystring2, replace

Michael Blasnik
[email protected]

----- Original Message ----- 
From: "Shourun Guo" <[email protected]>
To: <[email protected]>
Sent: Wednesday, April 14, 2004 12:49 PM
Subject: st: how to destring variables containing char " ' "


> I have a hard time to destring some variables with both characters and
numbers. The numbers are what I want. The characters may contain " ' ". If I
include this character in the option of ignore, I will get error message of
mismatch type. If  I don't, I will be reminded that the conversion won't be
done because some non-numeric character (I am sure it is the " ' ")exists.
It seems that the STATA confuses the double quotation and the single
quotation. Any suggestions.
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index