Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: tabout & Stata variable labels


From   Eric Booth <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   Re: st: tabout & Stata variable labels
Date   Tue, 17 Aug 2010 19:16:25 +0000

<>

You can use the h2() or h3() option to reference the value labels with a macro extended_fcn.
You can use the extended function `:var l <varname>' to reference the variable label  and the 
extended function `:val l <valuelabelname> <#>' to reference the value label for a category.

Im not a latex user, so here's an example that will open in a text editor or excel:

**********!
sysuse auto, clear
label li

**1.  value and variable labels in tabulations**
tabout mpg for using "test.xls" , replace  ///
h2(| "overwrite labels" | "overwrite2" | Total) ///
h1("title here for `:var l mpg' by `:var l for'")
 
tabout mpg for using "test.xls" , append  ///
h2(| `"`:label `:val l foreign' 0' "' | `"`:label `:val l foreign' 1'"' | Total)  ///
h1("title here for `:var l mpg' by `:var l for'")

**2.  variable labels in summary tables**
tabout for rep78 using "test.xls", append  c(mean mpg mean price mean weight)   ///
 bt font(bold) sum ptotal(single)  h2(| `:var l mpg' | `:var l price' | `:var l weight'| )

**********!

~ Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754

On Aug 17, 2010, at 1:37 PM, Andrea Bennett wrote:

> Dear Statalisters,
> 
> Is it really the case that -tabout- does not take into account the variable labels when generating a LaTeX table? I use the following command: -tabout sex language using example.tex, c(mean age mean dispincome mean grademath) replace style(tex) bt font(bold) sum ptotal(single) topstr(15cm) topf(top.tex) botf(bot.tex) botstr(Just a test.)-. Yet, although -tabout- uses "Female" & "Male" as well as "English speaking" & "Other language" for the vertical variables (it uses the value labels), it sticks to the variable names for the horizontal output. I've browsed the web and checked the handout but really could not find any option to make -tabout- show my variable labels. I simply would like to automatically show "Disposable income" instead of "dispincome". Does there exist a solution to my problem (without either renaming all the variables or editing my TEX-file afterwards)?
> 
> Many thanks for your help!
> 
> Andrea
> 
> 
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index