Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: finding non-numeric characters before I can destring


From   Michael McCulloch <[email protected]>
To   [email protected]
Subject   Re: st: finding non-numeric characters before I can destring
Date   Thu, 18 Oct 2007 08:54:05 -0700

Thanks Kit, this worked well to identify records containing nonnumeric characters.
I implemented your suggestion with my variable <number> using:

destring number, generate (newno) force /*generate a new variable*/
list number if newno>=. /*will show which have nonnumeric*/




Use the generate() option rather than replace, and use force. If you generate the new variable mostlynumber,

list number if mostlynumber>=.

will point out the keying errors.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


On Oct 18, 2007, at 2:33 AM, Michael wrote:


What I've done:
	. destring number, replace

Error message:
	number contains non-numeric characters; no replace
*
*   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