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

RE: st: missing data


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: missing data
Date   Sun, 14 Mar 2004 18:56:55 -0000

This route is likely to be problematic. Often this will 
only work with the extra call to -float()-. 

replace varname = . if float(varname) == -0.001

-mvdecode- is better in this respect. 

See my previous posting. 

Nick 
[email protected] 

Dev Vencappa
 
> Here's a dum question from a beginner. I have data from a 
> source that uses -0.001 as a flag for missing information. 
> How do I make Stata treat all such variables as missing? Is 
> there an easy way to replace all -0.001s with dots?
> Thanks!
> 
> A very easy command (if your variables is numeric)  is:
> 
> replace varname=. if varname==-0.001
> 
> Otherwise if your variable is a string variable, then you can 
> destring it first as follows:
> 
> destring varname, force replace gen(newvar1)
> 
> replace newvar1=. if newvar1==-0.001

*
*   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