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 <[email protected]>
To   [email protected]
Subject   RE: st: RE: xline macro or scalars
Date   Wed, 24 Sep 2003 13:18:43 -0400

Thanks Nick. My error was in thinking that the forval 1/3 would loop over the variables, and at each loop would clear/replace the contents of -local events-

The mkmat thought was incomplete, I had been trying to work through this for a fair time before I posted to the list the first time, and had thought that perhaps I could make a matrix from the three variables, and then read a row into a macro. I did not pursue it further, so I'll leave it there for today.

Thanks again for the explanation

Buzz





No. You should get up to 3 lines, by virtue of the
-forvalues- loop. Here's the code again:

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
}

The -forvalues- loop loops over -event1- to -event3-.
Of course, your variable names may well be something else,
and may not have such structure.
Buzz Burhans
[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