Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: xtline with labels


From   n j cox <[email protected]>
To   [email protected]
Subject   Re: st: RE: xtline with labels
Date   Thu, 07 Sep 2006 11:06:52 +0100

I did have that sense. However, I should point out that
a prior -decode- is not necessary here, as you can look
up the label on the fly.

forval i = 1/10 {
 	xtline ... if id == `i', subtitle("`: label (id) `i''")
}

Nick
[email protected]

Scott Cunningham

I'm reading the manual on -encode- and -decode-
and it solves in a simple manner things I've been taking the long way
around previously.

Nick Cox

> If your data include only 10 states, then it's
> more like
>
> decode id, gen(ID)
>
> forval i = 1/10 {
> 	local label = ID[`i']
> 	xtline ... if id == `i', subtitle("`label'")
> }
>
> or
>
> forval i = 1/10 {
> 	xtline ... if id == `i', subtitle("`= ID[`i']'")
> }
>

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