Statalist


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

Re: st: attempting to return the 'rstub' 'cstub' from svy: tab


From   Eric Booth <[email protected]>
To   [email protected]
Subject   Re: st: attempting to return the 'rstub' 'cstub' from svy: tab
Date   Wed, 27 Jan 2010 21:57:41 -0600

<>

On Jan 27, 2010, at 9:32 PM, Jason Ferris wrote:
> I would like to access the row labels and column labels from the results
> of a svy: tab. 
...
> I would simply like to access this labels (for any tabulation with any
> conditional statements) without having to manually collect them.

The labels aren't tied to the -svy:tab- command output, you can create, manipulate, 
and manage the labels using -label values-.

Here are some ways to access value labels without having to manually type them.  
It sounds like you might want to obtain them from globals for your purpose.

*------------------BEGIN
clear
use http://www.stata-press.com/data/r11/highschool
svy: tab sex race if race~=2
**
lab li
di "`e(colvlab)'"
di "`e(rowvlab)'"
**
di "`: label sex 1'"
di "`: label sex 2'"
**
global sex1: label sex 1
global sex2: label sex 2
macro li sex1 sex2
**modify labels using globals**
label def sex 3 "$sex1", modify
label li sex
*------------------END

Also, I always suggest the tools in -labutil- to anyone
working with value labels ("findit labutil").

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


On Jan 27, 2010, at 9:32 PM, Jason Ferris wrote:

> Hi all,
> I would like to access the row labels and column labels from the results
> of a svy: tab.  With 'set trace on' it appears that these labels are
> stored in macros rstub and cstub For example,
> use http://www.stata-press.com/data/r11/highschool
> svy: tab sex race if race~=2
> 
> the rstub labels are male and female
> the cstub labels are white and other
> 
> I would simply like to access this labels (for any tabulation with any
> conditional statements) without having to manually collect them.
> 
> I want to do this so I can apply them to matrix labels with information
> collected from the 'ereturn' library.
> 
> Cheers, 
> Jason
> 
> PS. Using Stata 11 on windows
> 
> ------------------------------------------
> DISCLAIMER: This message (including any attachments) is intended solely for the addressee(s) named and may contain confidential or privileged information. 
> If you are not the intended recipient, please delete it and notify the sender. 
> Views expressed in this message are those of the individual sender,and are not necessarily the views of the Turning Point Alcohol and Drug Centre (ABN: 68 223 819 017).  
> 
> <a href="http://www.turningpoint.org.au";>Turning Point Alcohol and Drug Centre</a>
> 
> Although this message and any attachments have been scanned for viruses by 'Trend Micro InterScan' at the time of sending, you are advised to rescan on receipt.
> 
> The whole or parts of this email may be subject to copyright of Turning Point Alcohol and Drug Centre (ABN: 68 223 819 017), and/or third parties. 
> You can only re-transmit, distribute or use the material if you are authorised to do so.
> 
> Please consider the environment before printing this email or attachments.
> 
> *
> *   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