Bookmark and Share

Notice: On March 31, it was 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]

st: appending graphs


From   "Lim, Raymond" <rl2240@columbia.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: appending graphs
Date   Fri, 25 Jun 2010 15:23:33 -0400

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);

Etc...

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!
-Raymond

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index