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 12:01:19 -0400

Thanks Nick,

You correctly interpreted my attempted task, and I will tuck your solution away for another similar situation. I have a couple of questions about your solution. What I needed was a way to mark (by an xline) the occurrence of, variably, one, two, or three events on the x axis of an xtline graph. It looks like the line I reproduce below would give me only a single xline per xtline graph, is that correct? And would you then continue the three options as overlayed graphs to create a singel graph with the three possible lines?

the line that looks like it grabs a single event to me is:


                if r(max) < . local events "`events'`r(max)' "

Second question, not at all a priority. Is there a way to use mkmat to accomplish this? That was where I was headng when I realized I could use recast(rcap) to create capped lines at each event occurrence and mark them that way.

Thanks for the demonstration, as always, it is informative.

Buzz





Buzz later found another solution;
nevertheless, a direct solution may be of interest.

As I understand it, Buzz has something like this

id
time
event1
event2
event3

and for each panel -event1-, -event2-,
-event3- contain the times of events 1 to 3
if and only if those events occur

and (presumably) there is at least one
other response variable.

I'd try something like this:

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
}

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