Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Rainald Borck" <Rainald.Borck@uni-passau.de> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | Antw: st: RE: use dummy variable for nonmissing data |
Date | Sat, 15 Jan 2011 21:10:22 +0100 |
Nick, sorry, probably I didn't explain myself well. I know Stata can't do anything with missing values. The question is this: say I have individuals from Germany in 1990 who all have missings in some variable y and I have created the dummy variable _IcouXyea_GER_1990. When I leave this variable in a regression of, say y on all the country-year dummies, Stata will drop it because all individuals from Germany in 1990 have missing y and all those who have nonmissing have a 0 in _IcouXyea_GER_1990. So I want to tell Stata to use only those _IcouXyea_country_year where there are individuals in the country and year with nonmissing values. This would be convenient (rather than manually adjusting the output for all dropped dummies). I tried by creating a variable nonmiss with values equal to 0 if there all individuals in a country in one year have missing values and 1 otherwise, and then preserve drop if nonmiss==0 xi. i.country*i.year, noomit reg y var1 _IcouXyea* restore but this doesn't seem to work (neither without noomit). Thanks Rainald >>> Nick Cox 14.01.11 17.01 Uhr >>> This is just part of the default behaviour. Stata can't do anything statistical if values are missing and it ignores such observations. What do you think it could possibly do with them? Nick n.j.cox@durham.ac.uk Rainald Borck I have survey data for individuals from several countries and years like this id country year var1 var2 1 A 1900 1 2 ... 200 B 1900 3 . ... I have created country_year dummies using xi i.country*i.year, noomit Now I want to tell Stata to temporarily drop (or not use) the variable _IcouXyea_country_year if that country does not have observations for that year (i.e. the variable is missing for all individuals from that country and particular year). Can anyone help? * * 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/