On 20/02/2008, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
--- K. Jensen wrote:
I would like to obtain the name of a variable's value label
programatically within a loop.
You can do that using extended macro function, see:
-help extended_fcn- and the example below:
*------------ begin example ---------------
sysuse auto, clear
foreach var of varlist _all {
local lab : value label `var'
di "`lab'"
}
*------------ end example -----------------
Thanks Martin. You're wonderful!
I hate to say but I forgot to ask my follow up question:-
How could I put the values and labels of a specific value label into a
local macro
i.e. for the auto data
. label list origin
origin:
0 Domestic
1 Foreign
two lists containing (0,1) and ("Domestic", "Foreign")
Thankyou yet again
Karin
*
* 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/