Hello Statalist,
I want to report joint coefficients and standard errors at the bottom of a regression table using outreg2, and I cannot find a way to add parentheses to the standard errors. I've tried with both addtext and addstat, displaying the local in several ways. I want to export the standard errors as they appear in the top/automatic table with the regression output generated by outreg2, with the S.E. with 2 decimals and within parentheses. See in the screenshot below that the closing parenthesis is not taken properly.
I'm showing below a simplified version, but in my code, I actually run hundreds of regressions which I first append using outreg, save as dta, and then combine sheets through a loop that combines Excel sheets into one spreadsheet. That is the reason why I export in two steps and I'd prefer to keep that, if possible.
-------------------------------------------------------------------
*ssc install dataex
clear
sysuse auto
reghdfe price headroom length, nocons absorb(foreign)
qui lincom headroom + length
local Lincom : di %9.2f `r(se)'
di "`Lincom'"
* Convert to string
local Lincom: di "(" string(`r(se)', "%9.2f") + ")"
di "`Lincom'"
local Lincom2: di "`Lincom'"
di "`Lincom2'"
local Lincom3: di "(`r(se)')"
di "`Lincom3'"
*outreg2 using "$results/test", replace dta dec(2) pdec(2) adds(Joint SE, "`Lincom'", Joint SE, `Lincom', Joint SE, "`Lincom2'", Joint SE, `Lincom2', Joint SE, "`Lincom3'", Joint SE, `Lincom3')
outreg2 using "$results/test", replace dta dec(2) pdec(2) addtext(Joint SE, "`Lincom'", Joint SE, `Lincom', Joint SE, "`Lincom2'", Joint SE, `Lincom2', Joint SE, "`Lincom3'", Joint SE, `Lincom3')
preserve
use "$results/test_dta", clear
export excel using "$results/test.xlsx", replace
restore
-------------------------------------------------------------------

Your help will be much appreciated
Many thanks
Maria
I want to report joint coefficients and standard errors at the bottom of a regression table using outreg2, and I cannot find a way to add parentheses to the standard errors. I've tried with both addtext and addstat, displaying the local in several ways. I want to export the standard errors as they appear in the top/automatic table with the regression output generated by outreg2, with the S.E. with 2 decimals and within parentheses. See in the screenshot below that the closing parenthesis is not taken properly.
I'm showing below a simplified version, but in my code, I actually run hundreds of regressions which I first append using outreg, save as dta, and then combine sheets through a loop that combines Excel sheets into one spreadsheet. That is the reason why I export in two steps and I'd prefer to keep that, if possible.
-------------------------------------------------------------------
*ssc install dataex
clear
sysuse auto
reghdfe price headroom length, nocons absorb(foreign)
qui lincom headroom + length
local Lincom : di %9.2f `r(se)'
di "`Lincom'"
* Convert to string
local Lincom: di "(" string(`r(se)', "%9.2f") + ")"
di "`Lincom'"
local Lincom2: di "`Lincom'"
di "`Lincom2'"
local Lincom3: di "(`r(se)')"
di "`Lincom3'"
*outreg2 using "$results/test", replace dta dec(2) pdec(2) adds(Joint SE, "`Lincom'", Joint SE, `Lincom', Joint SE, "`Lincom2'", Joint SE, `Lincom2', Joint SE, "`Lincom3'", Joint SE, `Lincom3')
outreg2 using "$results/test", replace dta dec(2) pdec(2) addtext(Joint SE, "`Lincom'", Joint SE, `Lincom', Joint SE, "`Lincom2'", Joint SE, `Lincom2', Joint SE, "`Lincom3'", Joint SE, `Lincom3')
preserve
use "$results/test_dta", clear
export excel using "$results/test.xlsx", replace
restore
-------------------------------------------------------------------
Your help will be much appreciated
Many thanks
Maria
Comment