Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combining two graphs, one at the country level and another at the region level

    Hello, sorry for so many emails, but I am really struggling :|

    My dataset is a cross section of health spending (named percap_total) per country for a given year. I also computed the average health spending by region in a new variable (named percap_total_reg).

    I wish to have a graph with information of health spending for all countries as well as the means for the regions (as if it was a new country).

    I did manage to run the graph at the country level and the graph at the region level but I did not manage to combine them with the command twoway. Could someone please help me out with this?

    code for the country level graph
    Code:
    separate percap_total, by(country == "Brazil")
    
    graph bar percap_total0 percap_total1, ///
    over(country, label(angle(90) labsize(vsmall)) sort(percap_total) descending) ///
    ytitle("") yscale(off) blabel(total, orientation(vertical) size(vsmall)) legend(off) nofill ///
    bar(2, bcolor(red))

    code for the region level graph
    Code:
    graph bar (mean) percap_total_reg, ///
    over(cat_reg, label(angle(90) labsize(vsmall)) sort(percap_total) descending) ///
    ytitle("") yscale(off) blabel(total, orientation(vertical) size(vsmall)) legend(off)
Working...
X