I have fourty predictors (x1 ... 40), each to anlayse in univariate regressions and would like to report the results in a compact table like this (ultimately I would also like to report margins for binary variables):
The progress so far yields an enormous table with a lot of white space (here shown only for predictors x1 to x4).
I've toyed with importing from Excel and reshaping in Stata (with limited success), but wonder if there is a better way?
Thankyou!
foreach var of varlist x1 x2 x3 x4 {
qui reg y `var'
estimates store m`var'
}
etable, replace estimates(m*) cstat(_r_b, nformat(%6.1f)) cstat(_r_ci, cidelimiter(" to") nformat(%6.1f))
| y | CI | |
| x1 | -0.1 | [-0.1 -0.0] |
| x2 | 0.1 | [-0.7 1.0] |
| x3 | 0.4 | [-0.4 1.2] |
| x4 | -0.9 | [-2.1 0.3] |
| Number of observations | 147 | 147 |
I've toyed with importing from Excel and reshaping in Stata (with limited success), but wonder if there is a better way?
Thankyou!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(x1 x2 x3 x4 y) 32 0 0 0 22 16 0 1 0 20 18 0 0 0 23 25 0 1 0 21 31 0 1 1 20 29 0 1 0 23 30 0 0 0 20 29 0 0 0 22 22 0 1 0 23 18 0 1 0 23 29 0 0 0 20 40 0 1 1 20 19 0 1 0 21 27 1 1 1 23 34 0 1 1 23 28 0 1 0 22 18 0 1 0 20 40 0 1 0 20 30 1 0 0 20 16 1 1 0 22 29 1 0 0 23 27 0 0 0 21 21 0 0 1 20 25 0 1 1 21 32 0 1 0 20 31 1 0 0 20 41 1 0 0 20 22 0 1 0 22 27 0 0 0 22 34 0 0 0 23 29 0 0 0 24 21 0 0 1 23 24 0 0 0 21 27 0 1 0 21 29 0 0 0 20 33 1 0 0 23 38 0 1 0 23 22 1 1 0 21 34 1 1 0 22 24 0 1 0 20 22 0 0 0 23 25 0 0 1 23 27 0 1 1 21 36 0 0 0 21 39 0 0 0 21 40 0 0 0 21 25 1 0 0 22 24 0 0 0 23 35 0 0 0 20 34 0 0 0 20 24 0 0 0 20 25 0 0 0 22 38 1 0 0 20 36 0 1 1 21 26 0 0 0 20 31 1 0 0 20 28 1 0 0 22 42 0 0 1 23 37 0 0 1 21 22 1 0 0 21 24 0 0 0 23 21 0 1 0 21 20 0 1 0 21 38 0 1 0 20 24 0 0 0 23 24 0 1 0 27 38 1 1 0 27 17 0 0 0 27 24 0 1 0 28 22 0 0 0 27 28 0 1 0 27 27 0 0 0 26 29 1 0 0 25 21 1 1 0 26 25 1 0 0 26 21 0 1 0 29 34 1 1 0 23 16 1 0 0 20 33 0 0 0 21 29 0 1 0 21 39 0 0 0 21 39 0 0 0 22 34 0 1 0 21 29 0 1 0 22 25 0 0 0 23 22 1 0 0 21 22 1 0 0 21 27 1 0 0 20 21 0 0 0 23 22 0 1 0 23 23 0 0 1 21 27 1 1 0 21 27 0 0 0 23 32 0 0 1 21 37 1 1 0 29 21 1 0 0 21 17 1 0 0 27 21 0 0 0 20 40 0 0 0 20 21 1 0 0 23 end
foreach var of varlist x1 x2 x3 x4 {
qui reg y `var'
estimates store m`var'
}
etable, replace estimates(m*) cstat(_r_b, nformat(%6.1f)) cstat(_r_ci, cidelimiter(" to") nformat(%6.1f))

Comment