Hello,

I keep getting the error not a twoway plot type. Was wondering if anyone had any suggestions.

levelsof county, local(cty)
levelsof disease, local(dis)
foreach c of local cty{
foreach d of local dis{
twoway (bar cases year if county=="`c'" & disease=="`d'", yaxis(2) ///
yscale(range(0,2500) axis(2)) ///
ytick(0(500)2500, axis(2)) ///
ylabel(0(500)2500, axis(2))) ///
(line rate1 year if county=="`c'" & disease=="`d'", sort yaxis(1) ///
yscale(range(0,35) axis(1)) ///
ytick(0(5)35, axis(1)) ///
ylabel(0(5)35, axis(1))) ///
(rcap lower_95__ci upper_95__ci year if county=="`c'" & disease=="`d'", yaxis(1) ///
yscale(range(0,35) axis(1)) ///
ytick(0(5)35, axis(1)) ///
ylabel(0(5)35, axis(1))), ///
scheme(sj) ///
legend(label(1 "Cases") label(2 "Rate") label(3 "95%CI") row(1)) ///
ytitle("Rate, per 100,000 population", axis(1)) ///
title("`d' in `c', 2001-2019") ///
note("Data source: kaggle.com/zayanmakar/infectious-diseases-county-year-and-sex")///
graph export "Output/top5.png", replace ///
putexcel set "Output/GraphFile.xlsx", modify ///
putexcel B`3' = image(Output/top5.png) ///
}
}