I have a dataset with 27 countries and I wish to run 6 regressions for every country only using data from that country.
Currently it does not start the loop. The error is dependent on how I try.
My loopcode below
(Suggestion on how to save with different file names using the Country variable are also welcome).
---------
foreach country in CountryFromReprRisk {
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom EcoIncidentsTotal Leverage i.Year if PrivateCom == 0 & country == CountryFromReprRisk , fe
estimate store PuEco
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom SocIncidentsTotal Leverage i.Year if PrivateCom == 0 & country == CountryFromReprRisk , fe
estimate store PuSoc
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom GovIncidentsTotal Leverage i.Year if PrivateCom == 0 & country == CountryFromReprRisk , fe
estimate store PuGov
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom EcoIncidentsTotal Leverage i.Year if PrivateCom == 1 & country == CountryFromReprRisk , fe
estimate store PrEco
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom SocIncidentsTotal Leverage i.Year if PrivateCom == 1 & country == CountryFromReprRisk , fe
estimate store PrSoc
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom GovIncidentsTotal Leverage i.Year if PrivateCom == 1 & country == CountryFromReprRisk , fe
estimate store PrGov
estimates table PuEco PrEco PuSoc PrSoc PuGov PrGov, star(0.1 0.05 0.01) drop(i.Year)
estimate drop PuEco PuSoc PuGov PrEco PrSoc PrGov
}
Currently it does not start the loop. The error is dependent on how I try.
My loopcode below
(Suggestion on how to save with different file names using the Country variable are also welcome).
---------
foreach country in CountryFromReprRisk {
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom EcoIncidentsTotal Leverage i.Year if PrivateCom == 0 & country == CountryFromReprRisk , fe
estimate store PuEco
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom SocIncidentsTotal Leverage i.Year if PrivateCom == 0 & country == CountryFromReprRisk , fe
estimate store PuSoc
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom GovIncidentsTotal Leverage i.Year if PrivateCom == 0 & country == CountryFromReprRisk , fe
estimate store PuGov
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom EcoIncidentsTotal Leverage i.Year if PrivateCom == 1 & country == CountryFromReprRisk , fe
estimate store PrEco
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom SocIncidentsTotal Leverage i.Year if PrivateCom == 1 & country == CountryFromReprRisk , fe
estimate store PrSoc
xtreg ln_ROA ln_employees ln_OperatingRevenue PrivateCom GovIncidentsTotal Leverage i.Year if PrivateCom == 1 & country == CountryFromReprRisk , fe
estimate store PrGov
estimates table PuEco PrEco PuSoc PrSoc PuGov PrGov, star(0.1 0.05 0.01) drop(i.Year)
estimate drop PuEco PuSoc PuGov PrEco PrSoc PrGov
}
Comment