Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: dump variable label value into local macro??


From   Sergio Correia <[email protected]>
To   [email protected]
Subject   Re: st: dump variable label value into local macro??
Date   Tue, 15 Nov 2005 12:29:19 -0500

Maybe this helps. It uses macro extended functions. See the -macro-
reference in the programming manual (page 224 in version 8 programming
manual)

sysuse auto
label list
 * We see that there is a label named "origin", and that 1 means "foreign"

local foo : label origin 1
display " `foo' "

Sergio.

On 11/15/05, [email protected]
<[email protected]> wrote:
> Hello All,
> I am using Stata/SE, v.9.1 for Macintosh.
> I am -forvalue-ing across values of a categorical variable w/ nine unique
> values and generating a graph for each unique value of this variable.
> This variable is numeric and i've attached a label to each value of this
> variable via -label define- and -label values-.  When generating the
> graphs, I would like to use the -subtitle- option to denote which level of
> the categorical variable is being graphed, albeit i want the actual label
> value written to the graph, not the value of the macro.  The abbreviated
> syntax follows:
>
> local i = 1
> forvalues i = 1(1)9 {
> gr hbar (mean) mean_abs_error mean_error_to_itd count_abs_error if
> segment2==`i' , ///
> subtitle("`i'") legend(off) ytitle("Absolute Error, Relative Error, &
> Project Num.") ///
> graph export m_error`i'.pdf, replace
>         local i = `i' + 1
>         }
>
> Any suggestions?  My perusal of the online & print documentation hasn't
> returned much in the way of a solution and my programming skills are
> woefully underdeveloped.
> Many thanks,
> Clint
>
> *
> *   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/
>

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