My advisor wants me to add dollar signs to my table of summary statistics. I generate this table and export it to Latex using Stata's esttab command.
I need to 1) Add dollar signs to some of the results cells (not all) and 2) Make sure that Latex can handle the dollar signs.
I think that 2 might be accomplished using the substitute option, but I can't figure out how to do 1. Here is some minimal code that I am trying to use to solve this problem.
sysuse auto, clear
estpost summarize price mpg weight length if foreign==0
est store A
estpost summarize price mpg weight length if foreign==1
est store B
esttab A B using $root/Outputs/test.tex, replace /// //a file path on my machine
cells("mean (fmt(%9.0fc %9.2fc %9.0fc))" "sd(par fmt(%9.0fc %9.2fc %9.0fc))") ///
mtitle("Domestic" "Foreign") ///
mgroups("Type", pattern(1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat( \cmidrule(lr){@span})) ///
nonumber booktabs f label collabels(none)
eststo clear
This produces:
&\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\\
I'd like to get it so the output would have \$ in front of the 6,072 and the 6,385
I see some discussion on the Statalist regarding workarounds for graphs, but nothing for esttab. Someone also mentions creating "custom formats" but I can't seem to find documentation on that anywhere.