In my case, I am finding pscore for doing PSM. To get there, I need to run the logistic regression to get the pscore.In my setting, I have 7 countries, all firms in country A have the "treatment" variables equal to 1, otherwise 0. My logit regression is

xtset firm year
xtlogit treatment  firm-level-variables  country-level-variables i.year, fe

while treatment equal to1 if firms in country A and 0 otherwise. firm-level-variables includes firm size, firm age... country-level variables include lngdp, unemployment ....

When running the regression


xtlogit treatment firm_age i.year, fe

I got the error immediately


outcome does not vary in any group

So, I asked myself and think this means that in at least one group, all observations have either a 0 or a 1 as the outcome variable. It makes sense because all observations of firms in country A will have treatment =1 and all observations of firms in other countries will have treatment=0, so they wont vary.

I am not sure whether my understanding is correct. If it is the case, would you please guide me how to overcome the problem. Thank you.


1 Answer 1


You need to collect more data if you want to use xtlogit. If the dependent variable does not vary in any group it is not possible to estimate the coefficients of fixed effects logit which uses within estimator.

You can also use some different models. For example, you could do pooled logit (just do regular logit on pooled data) or random effects logit (xtlogit with re option). However, all these models have different advantages and disadvantages so you should probably do some research on them before you do this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.