Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Using variable label in stata as you would a macro


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Using variable label in stata as you would a macro
Date   Mon, 26 May 2008 22:56:30 +0100 (BST)

You could do this like this:
outreg if `var'==1, se append ctitle(`:label variable `var'')

This uses extended macro functions, see: -help extended_fcn- for more.

Hope this helps,
Maarten

--- Conner Mullally <[email protected]> wrote:

> Hello all,
> I am wondering if there is a way in stata to use the labels
> given to variables as you might a macro.  For example,
> suppose you have a variable "state" where the values are the
> state names in the US.  You turn this into a series of dummy
> variables then run a series of regressions in a loop such
> as:
> foreach var of varlist _Istate_1-_Istate_50 {
> reg x y
> outreg if `var'==1, se append
> }
> What I'm wondering if there is a way to do this:
> foreach var of varlist _Istate_1-_Istate_50 {
> reg x y
> (some command that gives you the variable label of `var')
> outreg if `var'==1, se append ctitle(label of `var')
> }
> This would give you a spreadsheet where each column is
> labeled with the relevant state name. 
> 
> Any thoughts?  Thanks in advance.
> 
> 
> 
> 
> 
> 
> **********************************************************
> Conner Mullally
> Ph.D. Candidate
> Department of Agricultural and Resource Economics
> University of California, Davis
> office:                   530 752 1048
> cell:                      530 902 7484
> cell: (Lima):          001 511 989813181
> email and Skype: [email protected]
> 
> **********************************************************
> Conner Mullally
> Ph.D. Candidate
> Department of Agricultural and Resource Economics
> University of California, Davis
> office:                   530 752 1048
> cell:                      530 902 7484
> cell: (Lima):          001 511 989813181
> email and Skype: [email protected]
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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