Hi everyone,

I am running a long loop with a number of different 2SLS regressions using ivregress. I want to store the models in a dataset, so that I can compare them and plot them against each other—which I am doing using regsave. My question is that I would like to also store the F-statistic in the first stage (which I would check outside do by running estat first after the ivregress command). Is there anyway I can build this into the loop? A sample code is below:

* Create a local with the outcomes
local outcomes outcome1 outcome2 outcome3

* Run the analyses
foreach outcome in `outcomes'{
ivregress 2sls `outcome' covariate1 covariate2 ///
(endogenous_predictor = instrument)

regsave endogenous_predictor using results.dta, ci level(95) append addlabel ///
(Outcome, `outcome', Model, 2SLS, Predictor, Predictor)

* The loop goes by repeating similar chunks of code
}

Any way I can add the estat first command in the loop and store the F value in the same results.dta dataset?

Thank you very much in advance!