Type
gen byte notnumeric = real(number)==.
to compute an indicator for the obs without numeric values.
Alternatively, if you want to define flexible rules for valid imputs,
you can use regular expressions, e.g.
gen byte notnumeric = regexm(number, "^[-+]?[0-9]*\.?[0-9]+$")==0
See, e.g., http://www.regular-expressions.info/ on regular expressions.
ben
On 10/18/07, Michael McCulloch <[email protected]> wrote:
> Hello,
> I've got a field that's supposed to be all numbers but due to keying
> errors may contain letters. How can I find those records?
>
> What I've done:
> . destring number, replace
>
> Error message:
> number contains non-numeric characters; no replace
>
> Thank you,
> Michael
>
> --
>
> Michael McCulloch
> Pine Street Foundation
> 124 Pine St., San Anselmo, CA 94960-2674
> Tel: (415) 407-1357
> Fax: (415) 485-1065
> [email protected]
> *
> * 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/