%let gpath='C:\'; %let dpi=100; /*--Olympics Data--*/ data olympics; infile datalines dlm='#'; length Event $20; input Event $ Cost; format cost dollar.; datalines; Los Angeles '84 # 1 Seoul '88 # 8 Barcelona '92 # 15 Atlanta '96 # 7 Syndey '00 # 5 Athens '04 # 14 Beijing '08 # 43 London (Est) '12 # 40 ; run; /*proc print;run; */ /*--Bar Chart in data order--*/ ods html close; ods listing style=htmlblue gpath=&gpath image_dpi=&dpi; ods graphics / reset width=4in height=2.5in imagename='Olympics'; title 'Cost of Hosting Summer Olympics (in Billions)'; proc sgplot data=olympics; hbar event / response=cost dataskin=gloss datalabel nostatlabel; xaxis grid display=(nolabel); yaxis grid discreteorder=data display=(nolabel); run; /*--Bar Chart Descending order of response--*/ ods graphics / reset width=4in height=2.5in imagename='Olympics_Desc'; title 'Cost of Hosting Summer Olympics (in Billions)'; proc sgplot data=olympics; hbar event / response=cost dataskin=gloss datalabel categoryorder=respdesc nostatlabel; xaxis grid display=(nolabel); yaxis grid discreteorder=data display=(nolabel); run; /*--Bar Chart Ascending order of response--*/ ods graphics / reset width=4in height=2.5in imagename='Olympics_Asnd'; title 'Cost of Hosting Summer Olympics (in Billions)'; proc sgplot data=olympics; hbar event / response=cost dataskin=gloss datalabel categoryorder=respasc nostatlabel; xaxis grid display=(nolabel); yaxis grid discreteorder=data display=(nolabel); run; proc sort data=olympics out=ascending; by cost; /*--Unrolled graph--*/ data unrolled; format Len dollar.; set ascending nobs=count; Rmax=43; Max=43; Rad= _n_ / (count); Angle= cost / max; Len= max*angle * rad; run; proc print;run; /*--Bar Chart of unrolled lengths from Medal graph--*/ ods graphics / reset width=4in height=2.5in imagename='Olympics_Unrolled'; title 'Unrolled Bar Lengths'; proc sgplot data=unrolled; hbar event / response=len dataskin=gloss datalabel nostatlabel discreteoffset=-0.2 barwidth=0.4; hbar event / response=cost dataskin=gloss datalabel nostatlabel discreteoffset= 0.2 barwidth=0.4 transparency=0.7; xaxis grid display=(nolabel); yaxis grid discreteorder=data display=(nolabel); keylegend / location=inside position=topright; run;