Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: RE: appending graphs

From   "Martin Weiss" <>
To   <>
Subject   st: RE: appending graphs
Date   Sat, 26 Jun 2010 00:17:17 +0200


Have you had a look at -h xtline- yet? 


-----Original Message-----
[] On Behalf Of Lim, Raymond
Sent: Freitag, 25. Juni 2010 21:24
Subject: st: appending graphs

Hi Statalisters,
Is there a way to append graphs? I want to automate producing graphs by a
categorical variable, with with different number of lines. 
For example, Say you are creating time series graph of GPA by school and by
subject (subject 1...20, each school offering a combination of them). Thus
for each school, you have a graph with 3 to 5 different lines representing
GPA in different subjects across time. The command would be something along
the lines of

#delimit ;
tsset school year;
twoway (tsline mean if school==1 & subject==7) 
	 (tsline mean if school==1 & subject==8) 
	 (tsline mean if school==1 & subject==9);
twoway (tsline mean if school==2 & subject==4) 
	 (tsline mean if school==2 & subject==8);
twoway (tsline mean if school==2 & subject==1) 
	 (tsline mean if school==2 & subject==2);


I want to write a loop that will add lines to the graph as long as there are
subjects that still need to graphed. I was thinking about using a for-loop,
but I need to repeat "(tsline mean if school==__ & subject==__)" until all
the subjects are accounted for.

Thanks for any input!

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index