For a number of countries in PISA, I am studying the expectation of college graduation among adolescents interviewed in PISA. This is my dependent variable (expect_ISCED5A). I am considering both individual-level and school-level variables. Thus, my model is a multilevel logistic regression. My key independent variables at individual level are adolescent's gender (female) and father's education (fisced4).
My objective is to run a multilevel logistic regression for each country; extract the marginal effect of gender for the highest and lowest category of father's education (fisced4==1 / fisced4==4) and then compile the contrast between these marginal effects for each country in a single Excel file.
Instead of asking Stata to run a multilevel logistic regression for each country separately, and in order to simplify my do-file, I have decided to run the following loop. Some countries in the numlist (the list countries to run the loop over) are omitted because the corresponding national samples lack some important control variables.
Code:
foreach i of numlist 1/3 5/14 17 19/21 25/30 { xtmelogit expect_ISCED5A i.female i.fisced4 female#fisced4 if country3==`i' || schoolid:, variance margins, dydx(female) over(r.fisced4) predict(mu fixedonly) vsquish level (90) post estimates store Model`i' }
Code:
esttab * using "G:\Mi unidad\Word\Datos........ \ME_high_low_fath.csv", replace
Could anyone of you give me some guidance as to how to introduce the country label either in the loop or at the moment of exporting the results to a csv file?
Many thanks for your attention
And kind regards
Luis Ortiz
0 Response to Labelling units in a numlist of a loop
Post a Comment