If you have no other regressors then Richard Herron's suggestion to use collapse
in the comment is probably the best way to do this. If you do have other regressors then your model is just a fixed effects model where your groupping variable is just country-year. You can than estimate your model by typing
egen id = group(country year)
xtset id
xtreg y x1 x2, fe
alternatively:
egen id = group(country year)
areg y x1 x2, absorb(id)
The difference between these two is discussed in the helpfile of areg
. The relevant section is "areg
is designed for datasets with many groups, but not a number of groups that increases with the sample size. See the xtreg, fe
command for an estimator that handles the case in which the number of groups increases with the sample size."