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   Ben Jann <ben.jann@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   Thu, 27 Aug 2009 08:35:27 +0200

What do you mean by "formatted"? Labeled? Just add the -label- option:

. 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 ///
>     nogaps nonotes nonumber replace label
(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 (lbs.) & Mileage (mpg) & Constant &
Observations & R-squared \\
Price              & 2.044         &               & -6.707   & 74
      & 0.290     \\
                   & (0.377)       &               & (1174.4) &
      &           \\
Turn Circle (ft.)  & 0.00450       & -0.0591       & 27.32    & 74
      & 0.737     \\
                   & (0.000583)    & (0.0784)      & (3.271)  &
      &           \\

ben

On Thu, Aug 27, 2009 at 3:22 AM, richard boylan<richardtb25@gmail.com> wrote:
> The problem with this method is that the variables lose the formatting.
>
> I.e., in your example one would want "price" and "turn" formatted, but
> I don't see how to do that.
>
*
*   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