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.