I want to run these three regressions. Note that each has a different reference group, which is why I run them separately.
statsby _b, by(grp_iden) saving(reg_aaa.dta, replace): reg prezzo ib43.city_str i.marca_str, baselevels
statsby _b, by(grp_iden) saving(reg_bbb.dta, replace): reg prezzo ib6.city_str i.marca_str, baselevels
statsby _b, by(grp_iden) saving(reg_ccc.dta, replace): reg prezzo ib11.city_str i.marca_str, baselevels
However, before running each, I resort to the following:
Before running regression (1), I use: keep if rcode=="aaa"
Before running regression (2), I use: keep if rcode=="bbb"
Before running regression (3), I use: keep if rcode=="ccc"
Is there a way to run the three statsby
regressions more efficiently, and perhaps without the need to drop observations from the sample before each respective regression?
Something like the following could work, but I would need to find a way to select different reference groups (i.e., different XX in ib
XX.city_str
) in each rcode
set:
statsby _b, by(rcode grp_iden) saving(reg_ccc.dta, replace): reg prezzo ib11.city_str i.marca_str, baselevels