benjann / estout

Stata module to make regression tables
http://repec.sowi.unibe.ch/stata/estout/index.html
MIT License
70 stars 17 forks source link

Single character labels in math mode are not written to file correctly #11

Closed rpowers closed 8 years ago

rpowers commented 8 years ago

I have a coefficient in a table called "d". I'd like to label it in LaTex math mode as "$d$", but this only seems to work if I label it as "$ d$" (note the space between opening "$" and "d".

Here is an example:

. * to verify that I've got the most recent version of estout.
. ssc install esout, replace
. * load example data, estimate toy example model, suppress initial model output
. webuse "mumps2.dta", clear
. tsset tm
. qui arfima mumps

*does not work
. esttab ., rename(d "$d$")

----------------------------
                      (1)   
                    mumps   
----------------------------
mumps                       
_cons               420.3   
                   (0.16)   
----------------------------
ARFIMA                      
$                   0.498***
                 (229.85)   
----------------------------
sigma2                      
_cons             65289.6***
                  (16.32)   
----------------------------
N                     534   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

*works
. esttab ., rename(d "$ d$")
----------------------------
                      (1)   
                    mumps   
----------------------------
mumps                       
_cons               420.3   
                   (0.16)   
----------------------------
ARFIMA                      
$ d$                0.498***
                 (229.85)   
----------------------------
sigma2                      
_cons             65289.6***
                  (16.32)   
----------------------------
N                     534   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

I am using Stata 14.

sergiocorreia commented 8 years ago

This is more of a problem with Stata than with estout.

See e.g. http://www.statalist.org/forums/forum/general-stata-discussion/general/656092-display-dollar-values-in-twoway

A solution would be to use \( \) to enter math mode, which is better IMHO, as discussed here:

http://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode/513#513

benjann commented 8 years ago

Hi, you can also use a backslash:


. sysuse auto (1978 Automobile Data)

. qui regress price weight

. esttab, coeflabels(weight "\$d$")


                  (1)   
                price   

$d$ 2.044*** (5.42)

_cons -6.707

(-0.01)

N 74

t statistics in parentheses

(This does not work with the rename() option, though, because rename() is not intended to be used for providing labels for coefficients. It is intended to rename coefficients using names that comply to the Stata rules for variable names.)

ben

On 10 Dec 2015, at 16:29 , Ryan Powers notifications@github.com wrote:

I have a coefficient in a table called "d". I'd like to label it in LaTex math mode as "$d$", but this only seems to work if I label it as "$ d$" (note the space between opening "$" and "d".

Here is an example:

. * to verify that I've got the most recent version of estout. . ssc install esout, replace . * load example data, estimate toy example model, suppress initial model output . webuse "mumps2.dta", clear . tsset tm . qui arfima mumps

*does not work . esttab ., rename(d "$d$")


                  (1)   
                mumps   

mumps
_cons 420.3

(0.16)

ARFIMA
$ 0.498***

(229.85)

sigma2
_cons 65289.6***

(16.32)

N 534

t statistics in parentheses

  • p<0.05, \ p<0.01, *\ p<0.001

*works

. esttab ., rename(d "$ d$")

                  (1)   
                mumps   

mumps
_cons 420.3

(0.16)

ARFIMA
$ d$ 0.498***

(229.85)

sigma2
_cons 65289.6***

(16.32)

N 534

t statistics in parentheses

  • p<0.05, \ p<0.01, *\ p<0.001

I am using Stata 14.

— Reply to this email directly or view it on GitHub.

rpowers commented 8 years ago

Thanks to you both for the quick responses. Very helpful. And thank you @benjann for a great package.