Dear all,
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.
After running the loop, I try to export the results to a csv file as follows:
At opening the Excel file (after converting it from csv format), it is hard for me to identify to which country correspond the different contrast of margins that have been stored. For this reason, I would very much like to get the name of the country somehow in the Excel file.
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
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
Comment