Bookmark and Share

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]

re: st: loop for graphs


From   Christopher Baum <[email protected]>
To   "[email protected]" <[email protected]>
Subject   re: st: loop for graphs
Date   Fri, 8 Jul 2011 00:25:10 -0400

<>
I have 3 dependent variables (a1,b1,c1) that i want plot
against 1 var (x). i will be using scatter plot and  hope to use these
commands

foreach var of varlist a1-c1 {
graph twoway (scatter `var' x ) (lfit `var' x), saving(gr.gph)
}

with those line, i will only get the last graph but no the other 2
graphs.


Try

foreach var of varlist a1-c1 {
	graph twoway (scatter `var' x ) (lfit `var' x), saving(`var'.gph, replace)
}

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html




*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index