Hi all,
I am running multiple regressions at once and I wanted to only look at the significant results, instead of going through each regression table to check which one is significant. I have able to do this however I am struggling to meaningfully export it to excel. Ideally, I would want to export the coefficients for the significant results and show a "n.s." in the cells which are not significant.
Below is my current code, though this only outputs significant results. Any help on how to use eststo to store string values when the 'if' condition is not satisfied, will be really helpful!
I am running multiple regressions at once and I wanted to only look at the significant results, instead of going through each regression table to check which one is significant. I have able to do this however I am struggling to meaningfully export it to excel. Ideally, I would want to export the coefficients for the significant results and show a "n.s." in the cells which are not significant.
Below is my current code, though this only outputs significant results. Any help on how to use eststo to store string values when the 'if' condition is not satisfied, will be really helpful!
Code:
local i=1 foreach dv in dv1 dv2 dv3 { quiet reg `dv' IV //simple regression matrix r =r(table) if r["pvalue","IV"] < .05 { display _newline "IV's impact on `dv' is significant" regres //replay regression eststo linear`i' //store the significant regression result } else eststo linear`i="n.s." //this line is what I ideally want to do but of course eststo will not save a string value like this. estout * using test.xls,title ("DV:`dv'") cells(b(star fmt(3))) append unstack //only saves significant results clear results }
Comment