| ![](/includes/contimages/spacer.gif) |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: RE: values to labels
I don't think this does what they asked -- this creates value labels that
are sequential values labeled with the values of a variable -- in fact it
does what -encode- does more directly. The question was about labeling the
values of one variable using the values of another -- a slightly trickier
problem. I've written an ado that does this but haven't posted it to SSC
(no help file, not fully gracious with errors). I could send a copy
off-list if Caleb would like.
Michael Blasnik
----- Original Message -----
From: "Scott Merryman" <[email protected]>
To: <[email protected]>
Sent: Saturday, February 11, 2006 12:06 PM
Subject: st: RE: values to labels
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/