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

RE: st: RE: xline macro or scalars


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: xline macro or scalars
Date   Wed, 24 Sep 2003 17:34:08 +0100

I just said 

> I didn't get as far as thinking 
> about how you would distinguish the lines on 
> the graph. 

That referred to this code: 

> levels id, local(levels)
> foreach l of local levels {
>          // next line clears macro
>          local events
>          forval i = 1/3 {
>                  su event`i' if id == `l', meanonly
>                  if r(max) < . local events "`events'`r(max)' "
>          }
>          if "`events'" != "" {
>                  xtline response if id == `l', ///
>                  subtitle(panel `l') xline(`events')
>          }
>          else xtline response if id == `l', subtitle(panel `l')
>          more
> } 
> 

One approach would be something like this 

tokenize "solid dash dot" 

levels id, local(levels)
foreach l of local levels {
           // next line clears macro
           local xlopt 
           forval i = 1/3 {
                   su event`i' if id == `l', meanonly
                   if r(max) < . ///
		local xlopt "`xlopt' xli(`r(max)', lp(``i''))" 
           }
           xtline response if id == `l', /// 
                  subtitle(panel `l') `xlopt' 
           more
} 
 
Nick
[email protected]

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