Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: drop command & missing values


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: drop command & missing values
Date   Mon, 12 Oct 2009 12:11:57 +0200

<> 

It is possible in case the -drop- does not matter b/c -x1- is not part of
the estimation anyway:


*************
clear*
set obs 1000

gen x1=rnormal()
gen x2=rnormal()  
gen y=1+2*x1+3*x2+rnormal()

replace x1=500 in 200/205
replace x1=.   in 206/210
replace x2=.   in 212/214

reg y x?

preserve
	drop if x1>100 & x1!=.
	reg y x2
restore

preserve
	drop if x1>100
	reg y x2
restore
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Francesco
Trivieri
Gesendet: Montag, 12. Oktober 2009 11:49
An: [email protected]
Betreff: st: drop command & missing values

dear users,
when I drop some observations by writing:
1) drop if x>123
Stata drops also the missing values of the x variable.  When I use the 
following
2)  drop if x>123 & x!=.
Stata does not drop the missing values
As missing values are discarded in any estimations, Stata should consider 
the same obsevations whather command I use (1 or 2). By constrast, the 
number of obsevations  is much smaller when I run a regression after using 
the command 1)
thank you
Francesco 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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