I want to export my regression results in TeX format with R2 in brackets using esttab. The code below produces a table with no brackets around R2 and I couldn't find a way to add them.
sysuse auto
eststo: qui reg price mpg
esttab using "reg.tex", ///
compress noconstant replace gaps noobs ///
b(%8.3f) se(%8.3f) r2(%8.3f) nolines
I am not sure this is possible out-of-the-box with esttab
. The second-best is to automate this via sed
(if on Mac/Linux):
sysuse auto
eststo: qui reg price mpg
esttab using "reg.tex", ///
compress noconstant replace gaps noobs ///
b(%8.3f) se(%8.3f) r2(%8.3f) nolines
shell sed -i.bak -e 's#\\(R^{2}\\)#[R^{2}]#' reg.tex
On Windows it's possible to use powershell
for this, but I don't have access to a Windows machine to test it. A good starting point for Windows could be this answer.