Dear all, I am using Stata 14 on Windows 10. The following code is supposed to create a combined graph of several scatter plots for two variables. I used almost the same code several times for other graphs and it worked. However, this time I always get the error message "Series 0 not found" after all single graphs for the respective countries have been generated, i.e. no combined graph is created (I only get an empty combined graph). After spending several hours trying to fix that problem, I have no more idea...
It would be great, if someone could help me. Thanks a lot!
Code:
levelsof country, local(levels) local graph "" foreach i of local levels { summarize net_tradevalue_m if country == "`i'", meanonly local y_min = `r(min)' local y_max = `r(max)' local y_min_r = round(`y_min') local y_max_r = round(`y_max') scatter net_tradevalue_m instal if country == "`i'", /// xtitle("Number of items installed") /// ytitle("Import value (US$) net of re-exports") /// yscale(range(`y_min' `y_max')) ylabel(`y_min_r' `y_max_r') /// title("`i'") name(g_`i', replace) local graph "`graph' g_`i'" } grc1leg2 `graph', xtob1title ytol1title ytsize(vsmall) labsize(vsmall)
Code:
* Example generated by -dataex-. year country net_tradevalue_m instal 2005 "AE" .596557 3 2007 "AE" .57997 2 2008 "AE" 1.334496 2 2012 "AE" .82767 4 2013 "AE" 2.23105 2 2014 "AE" 3.857373 0 2015 "AE" 2.996899 0 2016 "AE" 3.456476 0 2017 "AE" 10.282882 0 2018 "AE" 6.563038 0 2019 "AE" 3.967778 0 1996 "AR" 2.930427 0 1997 "AR" 2.566672 0 1998 "AR" 2.713423 0 1999 "AR" 1.757973 20 2000 "AR" .820514 50 2001 "AR" 1.731663 40 2002 "AR" .433283 29 2003 "AR" .693137 33 2004 "AR" .537529 17 2005 "AR" 1.334015 65 2006 "AR" 1.607395 36 2007 "AR" 5.205558 141 2008 "AR" 13.348274 150 2009 "AR" 2.953936 45 2010 "AR" 8.285274 96 2011 "AR" 22.273457 407 2012 "AR" 15.632359 180 2013 "AR" 13.275552 181 2014 "AR" 10.507074 0 2015 "AR" 14.350166 0 2016 "AR" 11.726218 0 2017 "AR" 16.001951 0 2018 "AR" 9.526949 0 2019 "AR" 15.542093 0 1996 "AT" 9.284512 277 1997 "AT" 11.324429 232 1998 "AT" 11.18832 145 1999 "AT" 16.971384 273 2000 "AT" 37.53419 320 2001 "AT" 16.574034 330 2002 "AT" 16.691013 670 2003 "AT" 14.51144 365 2004 "AT" 24.916763 545 2005 "AT" 25.72232 485 2006 "AT" 35.112324 498 2007 "AT" 38.49554 621 2008 "AT" 46.18709 638 2009 "AT" 41.32523 508 2010 "AT" 36.71757 496 2011 "AT" 43.99167 628 2012 "AT" 40.30826 835 2013 "AT" 40.7037 720 2014 "AT" 51.64431 898 2015 "AT" 48.09217 987 2016 "AT" 73.0638 1686 2017 "AT" 81.19 1641 2018 "AT" 82.17607 1504 2019 "AT" 74.40486 1475 1996 "AU" 4.763878 250 1997 "AU" 10.905708 526 1998 "AU" 6.894873 347 1999 "AU" 8.601764 180 2000 "AU" 8.956798 440 2001 "AU" 10.291573 270 2002 "AU" 13.03586 421 2003 "AU" 17.182116 569 2004 "AU" 28.043364 652 2005 "AU" 29.79912 890 2006 "AU" 19.709654 719 2007 "AU" 26.95258 734 2008 "AU" 20.39395 781 2009 "AU" 8.937055 399 2010 "AU" 13.016978 624 2011 "AU" 17.47799 690 2012 "AU" 22.5622 1214 2013 "AU" 13.40527 323 2014 "AU" 11.591695 0 2015 "AU" 13.899048 0 2016 "AU" 16.18698 0 2017 "AU" 19.643173 0 2018 "AU" 28.74417 0 2019 "AU" 18.894983 0 2003 "BA" .0334 0 2004 "BA" .166554 0 2005 "BA" .074738 0 2006 "BA" .260394 0 2007 "BA" .535262 0 2008 "BA" .677682 0 2009 "BA" 1.532421 0 2010 "BA" .381561 2 2011 "BA" 3.805619 2 2012 "BA" .817377 0 2013 "BA" .587407 0 2014 "BA" 1.019831 0 2015 "BA" .604327 0 2016 "BA" .752781 0 2017 "BA" 1.305355 0 2018 "BA" 1.188319 0 2019 "BA" 2.205264 0 end
It would be great, if someone could help me. Thanks a lot!
Comment