Hi,

I want to loop a mixed model over a list of predictors (fixed effects) and store the coefficients and P values in Stata v. 17.

Code:
sysuse auto, clear

xtmixed price mpg || foreign:, covariance(independent) vce(robust)

foreach var of varlist mpg-gear_ratio {
    xtmixed price `var' || foreign:, covariance(exchangeable) vce(robust)
}
Can anyone help me with how to proceed to store the coefficients and P values of the fixed effect for each model?

Thanks in advance,

Sergio