Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Dorothy Bridges <dbstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Request for advice on simple summary tables for LaTeX |

Date |
Mon, 12 Mar 2012 19:55:19 -0700 |

Dear all, I'm reviving an old thread here to ask about tabstat, variable labels, and LaTeX. My question was asked below: what is the easiest way to write a summary-statistics table with variable labels (a la fsum) to tex? Martin suggested using estpost and esttab, but (certainly because of my own ignorance) I do not see how that solution allows for using variable labels. Thank you in advance for your help. On Fri, Oct 30, 2009 at 2:16 PM, Venable <venablito@gmail.com> wrote: > Dear Martin, > > Thank you very much for the suggestion and for your helpful example. > That is indeed a fantastic solution. I have been a fan of estout for a > long time but did not know it had this capacity. > > It even has a booktabs option! > > On Fri, Oct 30, 2009 at 3:48 PM, Martin Weiss <martin.weiss1@gmx.de> wrote: >> >> <> >> >> ******* >> sysuse auto, clear >> estpost tabstat price mpg weight, /* >> á*/ ástatistics( mean p25 median p75 ) /* >> á*/ ácolumns(variables) >> esttab using myfile.tex, á/* >> á*/ cells("price mpg weight") /* >> á*/ áreplace nonum noobs >> ******* >> >> >> HTH >> Martin >> >> >> -----Original Message----- >> From: owner-statalist@hsphsun2.harvard.edu >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Venable >> Sent: Freitag, 30. Oktober 2009 20:22 >> To: statalist@hsphsun2.harvard.edu >> Subject: st: Request for advice on simple summary tables for LaTeX >> >> Dear Statalisters, >> >> I have been experimenting with a few different methods for creating >> tables of summary statistics in LaTeX. For example, I would like to >> present the mean, 25th percentile, median and 75th percentiles of the >> variables price, mpg and weight in the auto.dta dataset. There are a >> number of nice alternatives in Stata but I am having some trouble >> getting any of these to do exactly what I would like. >> >> >> The simplest option seems to be -latabstat-, as in >> latabstat price mpg weight, /// >> á á á ácolumns(statistics) statistics(mean p25 p50 p75) /// >> á á á ácap(Summary Statistics) clabel(summary-statistics) /// >> á á á átf(summary-statistics) replace >> >> This is very easy to implement and produces nice-looking output, but >> as far as I can tell it is not possible to use variable labels. Is >> this correct? >> >> >> I very much like the look of the tables created by -tabout-, for >> example in the nice tutorial: >> http://www.ianwatson.com.au/stata/tabout_tutorial.pdf >> The tables in this tutorial look great, in particular the spacing of >> the horizontal lines. However, I am finding it difficult to figure out >> whether -tabout- is the right option for simple summary tables - it >> seems to be built for more complicated tasks. >> >> >> -sutex- is also very easy but appears to be limited to just a few >> statistics (mean, min, max). >> >> >> Finally, I wrote something myself to summarize, extract the r() >> information to a Stata matrix, and then convert that matrix to a LaTeX >> table using the -outtable- command. For example, >> >> cap program drop summaryrow >> program summaryrow >> á á á áargs VarToSum >> á á á ámatrix `VarToSum'=J(1,4,.) >> á á á ásumm `VarToSum', detail >> á á á álocal j = 1 >> á á á álocal statistics_list mean p25 p50 p75 >> á á á áforeach statistic of local statistics_list { >> á á á á á á á ámatrix `VarToSum'[1,`j']= `r(`statistic')' >> á á á á á á á álocal j = `j'+1 >> á á á á} >> á á á ámatrix colnames `VarToSum' = `statistics_list' >> á á á álocal myrowname: variable label `VarToSum' >> á á á ámatrix rownames `VarToSum' = `myrowname' >> end >> summaryrow price >> summaryrow mpg >> summaryrow weight >> matrix SummaryTable = price \ mpg \ weight >> outtable using SummaryTable, /// >> á á á ámat(SummaryTable ) /// >> á á á ánobox center f(%9.0f) /// >> á á á ácaption("Summary Statistics") clabel(summary-table) /// >> á á á áreplace >> >> This does allow me to use variable labels but is a bit hacked together >> given my poor programming skills. Also, it would be nice to tweak the >> spacing of the horizontal lines, which is probably possible but is a >> bit beyond me. >> >> >> >> In any event, I would really appreciate some guidance on how to >> combine the best of these methods. I apologize if this has been >> covered before or if the answer is obvious. I did some searching of >> the Statalist archives and looked through the help files of the >> different commands but was not able to figure this out. This is >> probably the result of my own deficiencies rather than any problem of >> the commands themselves. >> >> Thanks very much for any help you can provide. >> * >> * á 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/ * * 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/

**Follow-Ups**:**Re: st: RE: Request for advice on simple summary tables for LaTeX***From:*Dorothy Bridges <dbstata@gmail.com>

- Prev by Date:
**st: MGARCH DCC in panel settings - error?** - Next by Date:
**Re: st: RE: Request for advice on simple summary tables for LaTeX** - Previous by thread:
**st: MGARCH DCC in panel settings - error?** - Next by thread:
**Re: st: RE: Request for advice on simple summary tables for LaTeX** - Index(es):