Here is one way:
levelsof year, local(levels)
local i = 1
foreach l of local levels {
local mylabels "`mylabels' `i' `l'"
local ++i
}
label define label `mylabels'
label values round label
Hope this helps,
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Caleb Southworth
> Sent: Saturday, February 11, 2006 11:18 AM
> To: [email protected]
> Subject: st: values to labels
>
> Is there a convenient way to convert the values of one variable into
> labels? For example, if rounds of survey are given in a particular year,
> then
>
> . tab round, sum(year)
>
> round | Summary of year
> number | Mean Std. Dev. Freq.
> ------------+------------------------------------
> 1 | 1992 0 4763
> 2 | 1993 0 6037
> 5 | 1994 0 2787
> 6 | 1995 0 2650
> 7 | 1996 0 2611
> 8 | 1998 0 2651
> 9 | 2000 0 2733
> 10 | 2001 0 3201
> 11 | 2002 0 3339
> 12 | 2003 0 3351
> ------------+------------------------------------
> Total | 1996.8892 3.9638084 34123
>
> Of course, I could define labels for round and label its values. My desire
> is to automate this process over several surveys and many variables to
> label graph axes. Thanks!
>
> Caleb
*
* 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/