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

st: RE: Getting at value labels

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Getting at value labels
Date   Thu, 12 Feb 2004 22:13:22 -0000

I would do this. I assume value labels attached
to -marEduc-. 

separate aRate, by(marEduc) shortlabel 
local aRatevars "`r(varlist)'" 
twoway connected `aRatevars' year 

Sometimes even the -shortlabel- is too long. 
(There should be an option -veryshortlabel-
to go beyond the -shortlabel- I suggested 
a while back.)  

ssc inst labutil 
labnoeq `aRatevars' 

will cut them down further. The first principles
way to do that is something like 

foreach v of local aRatevars { 
	local label : variable label `v' 
	local eq = index(`"`label'", "=") - 1 
	local label = substr(`"`label'",1,`eq') 
	label var `v' `"`label'"' 
[email protected] 

Danielle H. Ferry
> I would like to make Stata use the value labels for my variable 
> <marEduc> as the descriptive text in the legend for a 
> scatterplot. See 
> below - right now, I have specified the descriptive text 
> specifically. 
> Is there a way to get Stata to do this automatically?
> twoway (connected aRate year if marEduc==1)
> 	(connected aRate year if marEduc==2)
> 	(connected aRate year if marEduc==3)
> 	(connected aRate year if marEduc==4)
> 	(connected aRate year if marEduc==5)
> 	(connected aRate year if marEduc==6),
> 	legend(label(1 "Unmarried/<12 yrs")
> 	label(2 "Unmarried/12 yrs")
> 	label(3 "Unmarried/13+ yrs")
> 	label(4 "Married/<12 yrs")
> 	label(5 "Married/12 yrs")
> 	label(6 "Marred/13+ yrs")) ;

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index