%let name=child_poverty; /* Set your current-working-directory (to read/write files), if you need to ... %let rc=%sysfunc(dlgcdir('c:\someplace\public_html')); */ filename odsout '.'; /* Imitating a graph from: http://depts.washington.edu/eqhlth/pages/charts.html Using more recent data from: https://stats.oecd.org/Index.aspx?DataSetCode=IDD Change 'Measure' to "Age group 0-17: Poverty rate after taxes and transfers" Export text file (csv) saved as oecd_data.csv The csv has more than just the poverty data, therefore subset it as follows: head -1 oecd_data.csv > child_poverty.csv grep "0-17: Poverty rate" oecd_data.csv >> child_poverty.csv */ proc import out=my_data datafile="child_poverty.csv" dbms=csv replace; getnames=yes; datarow=2; guessingrows=all; run; proc sql noprint; create table my_data as select unique country, var4 as age_group, methodology, year, value format=percent7.2 as poverty_rate, flag_codes, flags from my_data group by country having year=max(year); quit; run; proc sort data=my_data out=my_data; by country year methodology; run; data my_data; set my_data; label poverty_rate='Child Poverty Rate'; if country="China (People's Republic of)" then country='China'; by country; if last.country then output; run; proc sort data=my_data out=my_data; by poverty_rate country; run; data my_data; set my_data; barnum=_n_; if mod(barnum,2)=0 then colorvar=1; else colorvar=2; run; data anno_text; set my_data; length label $100 anchor x1space y1space $50; layer="front"; function="text"; textcolor="gray33"; textweight='normal'; width=100; widthunit='percent'; y1space='datavalue'; yc1=country; x1space='datavalue'; x1=poverty_rate; anchor='right'; label=trim(left(put(poverty_rate*100,comma7.1))); textsize=7; output; x1space='wallpercent'; x1=100; anchor='right'; label=trim(left(country)); textsize=9; output; run; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Child Poverty Rate, by country") style=htmlblue; ods graphics / imagemap tipmax=2500 imagefmt=png imagename="&name" width=600px height=900px noborder; title1 h=13pt color=gray33 "Child Poverty Rates"; title2 h=1pt ' '; footnote1 h=9pt c=gray77 italic "Percent of children aged 0-17 living in poverty, after taxes and transfers."; footnote2 h=9pt c=gray77 italic "Data source: most recent data for each country (snapshot 2017, oecd.org)"; /* proc sgplot data=my_data; hbarparm category=country response=poverty_rate; run; proc sgplot data=my_data; hbarparm category=country response=poverty_rate / barwidth=1; yaxis display=(nolabel novalues noticks) offsetmin=.014 offsetmax=.014; run; proc sgplot data=my_data noautolegend; styleattrs datacolors=(cxB0E2FF cx67C8FF); hbarparm category=country response=poverty_rate / group=colorvar barwidth=1; yaxis display=(nolabel novalues noticks) offsetmin=.014 offsetmax=.014; run; proc sgplot data=my_data noautolegend; styleattrs datacolors=(cxB0E2FF cx67C8FF); hbarparm category=country response=poverty_rate / group=colorvar barwidth=1 nooutline; yaxis display=(nolabel novalues noticks) colorbands=odd colorbandsattrs=(color=graydd) offsetmin=.014 offsetmax=.014; run; proc sgplot data=my_data noautolegend; styleattrs datacolors=(cxB0E2FF cx67C8FF) wallcolor=grayf3; hbarparm category=country response=poverty_rate / group=colorvar barwidth=1 nooutline; yaxis display=(nolabel novalues noticks) colorbands=odd colorbandsattrs=(color=graydd) offsetmin=.014 offsetmax=.014; run; */ proc sgplot data=my_data noautolegend sganno=anno_text; styleattrs datacolors=(cxB0E2FF cx67C8FF) wallcolor=grayf3; hbarparm category=country response=poverty_rate / group=colorvar barwidth=1 nooutline tip=(country year poverty_rate); xaxis display=(nolabel) values=(0 to .35 by .05) valueattrs=(size=9pt color=gray33) grid gridattrs=(color=white) offsetmin=0 offsetmax=.22; yaxis display=(nolabel novalues noticks) colorbands=odd colorbandsattrs=(color=graydd) offsetmin=.014 offsetmax=.014; run; quit; ODS HTML CLOSE; ODS LISTING;