Statalist


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

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


From   "Conner Mullally" <mullally@primal.ucdavis.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Using variable label in stata as you would a macro
Date   Mon, 26 May 2008 16:38:17 -0500

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: ccmullally@ucdavis.edu

**********************************************************
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: ccmullally@ucdavis.edu
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index