I had a similar problem: I wanted to color the cells differently depending on the significance level. In the end, the simplest automated solution I could come up with was changing the esttab code ... It's easier to do than it seems.
Find the following code in estout.ado :
if `:length local thevalue'<245 { local thevalue: di `fmt_m' `"`macval(thevalue)'"' }
Right after that you can insert, for example
local thevalue `"\$`macval(thevalue)'\$"'
This will create:
&\multicolumn{2}{c}{Type} \\\cmidrule(lr){2-3} &\multicolumn{1}{c}{Domestic}&\multicolumn{1}{c}{Foreign}\\ \midrule Price &$ 6,072$&$ 6,385$\\ &$ (3,097)$&$ (2,622)$\\ Mileage (mpg) &$ 19.83$&$ 24.77$\\ &$ (4.74)$&$ (6.61)$\\ Weight (lbs.) &$ 3,317$&$ 2,316$\\ &$ (695)$&$ (433)$\\ Length (in.) &$ 196$&$ 169$\\ &$ (20)$&$ (14)$\\ \midrule Observations & 52& 22\\
(Don't forget program drop estout before export to reload .ado)
So, all the numerical values ββin the main table are enclosed in $ signs. If you need only certain values, you can fulfill the simple regex condition. For example, if you cannot capture only those values ββwhere there is a comma (for some reason), you can do:
if strpos("`macval(thevalue)'", ",") { local thevalue `"\$`macval(thevalue)'\$"' }
And you can also add your own variant (only at the beginning of estout.ado) so that the changed behavior does not start all the time.
Andrei
source share