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 <[email protected]>
To   [email protected]
Subject   Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns
Date   Thu, 27 Aug 2009 21:23:57 +0200

> However, adding * messes things up.

I don't understand. Adding * where? do you mean "significance stars"?

The following looks good to me:

. esttab using test.txt, se r2 wide tab ///
>    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 4:40 PM, richard boylan<[email protected]> wrote:
> Thanks, I thought having variable names was enough so adding the label
> option fixes the problem.
>
> However, adding * messes things up.
>
>
>
>
> On Thu, Aug 27, 2009 at 1:35 AM, Ben Jann<[email protected]> wrote:
>> 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<[email protected]> 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/
>>
>
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index