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

RE: st: RE: xline macro or scalars


From   Buzz Burhans <wsb2@cornell.edu>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: RE: xline macro or scalars
Date   Wed, 24 Sep 2003 13:19:56 -0400

You are good!

Thanks again

Buzz


At 05:34 PM 9/24/2003 +0100, you wrote:
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
n.j.cox@durham.ac.uk

*
*   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/
Buzz Burhans
wsb2@cornell.edu


*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index