Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns


From   richard boylan <richardtb25@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns
Date   Wed, 26 Aug 2009 18:53:42 -0500

this works great too! Thanks.

On Wed, Aug 26, 2009 at 4:03 PM, Ben Jann<ben.jann@gmail.com> wrote:
> Here are my 50 cents to this problem (-moremata- required):
>
> <--->
> . eststo clear
>
> . sysuse auto
> (1978 Automobile Data)
>
> . qui eststo: reg price weight
>
> . qui eststo: reg turn weight mpg
>
> . esttab using test.txt, se r2 wide tab nostar ///
>>     varl(_cons cons) nogaps nonotes nonumber replace
> (output written to test.txt)
>
> . mata
> ------------------------------------------------- mata (type end to
> exit) ----------------------------------------------
> : S = mm_insheet("test.txt")'
>
> : S = S + ((colmax(strlen(S)):-strlen(S)):*" ") // add white space
>
> : S[,cols(S)] = S[,cols(S)] :+ " \\"            // add row end
>
> : mm_outsheet("test.tex", S, "replace", " & ")
>
> : end
> ------------------------------------------------------------------------------------------------------------------------
>
> . type test.tex
>      & weight     & mpg      & cons     & N  & R-sq  \\
> price & 2.044      &          & -6.707   & 74 & 0.290 \\
>      & (0.377)    &          & (1174.4) &    &       \\
> turn  & 0.00450    & -0.0591  & 27.32    & 74 & 0.737 \\
>      & (0.000583) & (0.0784) & (3.271)  &    &       \\
> <--->
>
> If you need a header and footer, do something like:
>
> <--->
> . mata
> ------------------------------------------------- mata (type end to
> exit) ----------------------------------------------
> : HEAD = ("\begin{tabular}{l*{5}{c}}", "\hline")'
>
> : FOOT = ("\hline", "\begin{tabular}")'
>
> : mm_outsheet("test.tex", HEAD, "replace")
>
> : mm_outsheet("test.tex", S, "append", " & ")
>
> : mm_outsheet("test.tex", FOOT, "append")
>
> : end
> ------------------------------------------------------------------------------------------------------------------------
>
> . type test.tex
> \begin{tabular}{l*{5}{c}}
> \hline
>      & weight     & mpg      & cons     & N  & R-sq  \\
> price & 2.044      &          & -6.707   & 74 & 0.290 \\
>      & (0.377)    &          & (1174.4) &    &       \\
> turn  & 0.00450    & -0.0591  & 27.32    & 74 & 0.737 \\
>      & (0.000583) & (0.0784) & (3.271)  &    &       \\
> \hline
> \begin{tabular}
> <--->
>
> ben
>
> On Wed, Aug 26, 2009 at 9:33 PM, richard boylan<richardtb25@gmail.com> wrote:
>> My problem was not extracting the coefficients, but formatting the
>> table using listtex.
>>
>> What I need is to get the standard error in the line below and in
>> parenthesis, and I don't think that listtex will allow me to do that.
>>
>> So, what I need is
>>
>>
>> Dep var.    Coef       Sample  R-squared
>> Reg 1        0.65      11,224     0.56
>>                (0.05)
>>
>>
>> and what I am having difficult is getting that (0.05) to appear in the table.
>>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index