Bookmark and Share

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]

Re: st: tabout & Stata variable labels


From   Andrea Bennett <mac.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: tabout & Stata variable labels
Date   Thu, 19 Aug 2010 17:35:48 +0200

Dear Eric,

This helped a lot! With LaTeX, on just has to make sure that the "|" are substituted by ""&"".

One problem however persists: The variable *labels* are correctly inserted into the .tex file, however the variable *names* are also there and I couldn't find any option to delete them automatically, i.e. having the variable labels only.

If anyone knows a work around, please let me know.

Kind regards,

Andrea


On Aug 17, 2010, at 21:16 , Eric Booth wrote:

> <>
> 
> 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
> ebooth@ppri.tamu.edu
> 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/


*
*   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   |   Site index