Recently, while browsing health care data, I came across the graph shown below. The graph includes the healthy life expectancy at birth by countries in the EU, along with the associated per capita expenditure. The graph also shows estimate of potential gain in life expectancy by increasing expenditure efficiency.
The graph has some interesting characteristics, so I thought it would be interesting to see how easy it is to make the same chart using SGPLOT procedure. The first task was to enter some of the data into a SAS data set, and I did that for about half of the countries, enough to proceed with the graph. Here is the graph and the code. See the linked program at bottom for full code.
title 'A closer look at relative efficiency in EU healthcare systems'; footnote j=l h=7pt italic bold '* According to Heijink R. et al, adjusted for the impact of lifestyle differences,' ' such as smoking and alcohol consumption (2015)'; proc sgplot data=efficiency2 noborder; styleattrs datacolors=(%rgbhex(91,187,229) %rgbhex(59,138,197) %rgbhex(233,68,147)) axisextent=data; vbarparm category=country response=Value / group=cat groupdisplay=stack outlineattrs=(color=white) barwidth=0.7 baselineattrs=(thickness=0) filltype=gradient; vbarparm category=country response=expense / barwidth=0.3 y2axis outlineattrs=(color=white) baselineattrs=(thickness=0); yaxis label='Healthy life expectancy at birth in years' values=(0 to 90 by 10) offsetmax=0.2 labelposition=datacenter; y2axis label='Health care expentiture per capita' values=(0 to 4500 by 500) offsetmax=0.2 labelposition=datacenter; xaxis display=(noline noticks nolabel); keylegend / across=1 noborder; inset 'Member States achieve very different levels of health outcomes for the same money spent.' ' All Member States could have better results without spending more and by increasing ' 'expentiture efficiency.' / textattrs=(size=7pt) position=top; run;
In this program, I used the macro %rgbhex() by Perry Watts to match the colors.
On first view, the "Gain in life expectancy" bar segments look smaller in my graph. Then, on closer examination, one can see that the original graph sets the y axis min=50, causing the bar segments to get longer. This could actually distort the perception of life expectancy vs gain and expense, as the y2 axis min=0. In my graph, both y axes are zero based.
Also, we should note that the relative lengths of the blue and red bars have no significance, as the axis values on Y and Y2 are very different, and different between the graphs.
The original graph data is sorted by descending "Healthy life expectancy at birth". I thought it may be useful to also view the same data sorted by per capita expense. So, I sorted the data and the new graph is shown below.
In this graph, we can really appreciate the difference in per capita expense between the countries. Also, the countries with lower expense still seem to enjoy a pretty good life expectancy. Actually, Ireland and Spain have relatively low expense, and the high life expectancy (amongst the EU contries in my graph)!
Full SGPLOT code: EU_Health_Efficiency