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: problem using local


From   Viktor Emonds <Viktor.Emonds@soc.kuleuven.be>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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/


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