Hi there,
I was trying to run an -xtreg- regression on a panel data and got the infamous "no observation" error message. However, if I drop the observations where all variables are missing, the -xtreg- command runs through beautifully and no error message. Please see below the log file.
Stata is supposed to drop all observations with missing values for any variable used in the regression. So the -drop if...- line of code after -preserve- should be irrelevant preceding a regression command. However, Stata seems to suggest I have to manually drop those observations if missing values occur for all variables before it's willing to run -xtreg-.
Thanks for any pointers.
Daifeng
Log file below:
. use data, clear
. xtset facid year
. preserve
. drop if ladm==. & paydiff_post==. & per_under65==. &per_female==. &per_black==. & per_hispanic==. &per_pov==.
(19,039 observations deleted)
.xtreg ladm_mcare paydiff_post per_under65 per_female per_black per_hispanic per_pov i.year, fe
(runs fine; output omitted)
. restore
. xtreg ladm_mcare paydiff_post per_under65 per_female per_black per_hispanic per_pov i.year, fe
no observations
r(2000);
I was trying to run an -xtreg- regression on a panel data and got the infamous "no observation" error message. However, if I drop the observations where all variables are missing, the -xtreg- command runs through beautifully and no error message. Please see below the log file.
Stata is supposed to drop all observations with missing values for any variable used in the regression. So the -drop if...- line of code after -preserve- should be irrelevant preceding a regression command. However, Stata seems to suggest I have to manually drop those observations if missing values occur for all variables before it's willing to run -xtreg-.
Thanks for any pointers.
Daifeng
Log file below:
. use data, clear
. xtset facid year
. preserve
. drop if ladm==. & paydiff_post==. & per_under65==. &per_female==. &per_black==. & per_hispanic==. &per_pov==.
(19,039 observations deleted)
.xtreg ladm_mcare paydiff_post per_under65 per_female per_black per_hispanic per_pov i.year, fe
(runs fine; output omitted)
. restore
. xtreg ladm_mcare paydiff_post per_under65 per_female per_black per_hispanic per_pov i.year, fe
no observations
r(2000);
Comment