Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: appending graphs
From
"Lim, Raymond" <[email protected]>
To
"[email protected]" <[email protected]>
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/