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: problem using local
From
Viktor Emonds <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: problem using local
Date
Thu, 14 Jun 2012 11:16:07 +0000
Dear all,
I am trying to write a code for a simple loop of graphs, which I would then like to combine. The idea is to specify graphs for a number of variables I specified in a local, save them under the same name and then combine them by again calling the local with graph combine after the loop. Curiously, sometimes my current code works and sometimes the last line gives me an error (r 4027, incompatible types, may not assign class to double) in Stata 11. Any ideas?
local iv age female hinctnta eduyrs polintr lrscale
foreach var of local iv {
twoway (scatter poltrst `var') (lfit poltrst `var') (lowess poltrst `var'), name(`var') nodraw
}
graph combine `iv', name(poltrst)
Best,
Viktor
*
* 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/