Statalist The Stata Listserver


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

st: RE: dropping observations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: dropping observations
Date   Sun, 17 Jun 2007 18:06:04 +0100

I cannot comment on STATA. In Stata, numeric missing counts 
as very large, so 

drop if x > 450

will -drop- all observations on which -x- is missing. 

(Note that the test 

... if x != . 

does _not_ exclude any of .a ... .z.) 

This is an FAQ: 

FAQ     . . . . . . . . . . . . . . . . Logical expressions and missing values
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W. Gould
        2/03    Why is x > 1000 true when x contains missing value?
                http://www.stata.com/support/faqs/data/values.html

Running regressions is a different matter. -regress-, for example, ignores observations
with missing values, but it does _not_ -drop- them. 

Nick 
[email protected] 

[email protected]

> when I use the following command:
> drop if x>450
> STATA drops a lot of observations, while when  I exclude 
> missing values as 
> follows:
> drop if x>450 & x!=.
> STATA eliminates just a couple of observations 
> I realized this when I run a regression including x as 
> regressor. If STATA 
> drops missing data with the first command,  shouldn't drop the same 
> observations when I run the regression after using the second command?
> why doesn't it happen?

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