**announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
richgold@ix.netcom.com |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: adding different text to each of a set of graphs |

Date |
Fri, 26 Apr 2013 17:33:55 -0400 (GMT-04:00) |

Phil, thank you very much; gives me a good enough idea to work with! Rich -----Original Message----- >From: Phil Schumm <pschumm@uchicago.edu> >Sent: Apr 26, 2013 4:53 PM >To: statalist@hsphsun2.harvard.edu >Subject: Re: st: adding different text to each of a set of graphs > >On Apr 26, 2013, at 2:30 PM, richgold@ix.netcom.com wrote: >> I am producing a set of line graphs (e.g., via -twoway line o time, by(id)-) and I want to add the value of a fourth variable as a "note" (or other form of text) to each of the graphs; is this possible? if yes, how? > > >There are probably better ways to do this, but one approach would be > > > tempvar obs > gen `obs' = _n > qui levelsof id, loc(ids) > foreach id of loc ids { > qui sum `obs' if id==`id' > line o time if id==`id', t1title(`id') note(`"`=note[`r(min)']'"') /// > name(p`id', replace) > loc plots "`plots' p`id'" > } > gr combine `plots', ycommon xcommon note("Graphs by id") > > >As you can see, this assumes that the var id is numeric and that the value of note (i.e., your 4th variable) is constant within unique values of id. Note that the graph this generates will not look *exactly* like that you get with the -by()- option, but you can make it so with a few additional graph options if you'd like. > > >-- Phil * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: st :Endogenous variables in Survival analysis** - Next by Date:
**Re: st: st :Endogenous variables in Survival analysis** - Previous by thread:
**Re: st: adding different text to each of a set of graphs** - Next by thread:
**st: simulated value of a ratio does not compare to manually calculated value** - Index(es):