%let gpath='.'; %let dpi=300; ods html close; ods listing gpath=&gpath image_dpi=&dpi; /*--Macro by Perry Watts--*/ %macro RGBHex(rr,gg,bb); %sysfunc(compress(CX%sysfunc(putn(&rr,hex2.)) %sysfunc(putn(&gg,hex2.)) %sysfunc(putn(&bb,hex2.)))) %mend RGBHex; data Readiness_Bar_Panel; format Value percent.; input School $1-14 Level $15-35 Value; datalines; This School Start 9th. Grade 1.00 This School Graduate. High School 0.72 This School Enter. College 0.45 This School Continue in. College 0.24 State Start 9th. Grade 1.00 State Graduate. High School 0.80 State Enter. College 0.50 State Continue in. College 0.31 ; run; ods html; proc print;run; ods html close; /*--Simple bar chart--*/ ods graphics / reset width=5in height=2.25in imagename='Readiness_Bar_Panel' noborder; title j=l h=1 'College Readiness'; proc sgpanel data=Readiness_Bar_Panel noautolegend ; styleattrs datacolors=(%rgbhex(254, 145, 104) %rgbhex(130, 109, 146)) datacontrastcolors=(black); panelby School / columns=2 novarname onepanel sort=data noheaderborder noborder; hbar level / response=value datalabel group= school baselineattrs=(thickness=0) dataskin=pressed; rowaxis reverse display=(nolabel noticks noline) splitchar='.' fitpolicy=splitalways; colaxis offsetmin=0 display=none grid; run; /*--Simple bar chart--*/ ods graphics / reset width=5in height=2.25in imagename='Readiness_Bar_Cluster' noborder; title j=l h=1 'College Readiness'; proc sgplot data=Readiness_Bar_Panel nowall noborder; styleattrs datacolors=(%rgbhex(254, 145, 104) %rgbhex(130, 109, 146)) datacontrastcolors=(black); hbar level / response=value datalabel group=school groupdisplay=cluster baselineattrs=(thickness=0) dataskin=pressed grouporder=reversedata; yaxis reverse display=(nolabel noticks noline) splitchar='.' fitpolicy=splitalways; xaxis offsetmin=0 display=none grid; keylegend / location=inside position=bottomright across=1; run; /*--Data for Info Graphics--*/ data Readiness; format value percent.; input School $1-14 Level $15-35 Value; datalines; This School Start 9th. Grade 1.00 This School Graduate. High School 0.72 This School Enter. College 0.45 This School Continue in. College 0.24 State Start 9th. Grade 1.00 State Graduate. High School 0.80 State Enter. College 0.50 State Continue in. College 0.31 ; run; proc print;run; /*--Infographics Icons--*/ %let file1=C:\Work\Blogs\Graphically Speaking\2016\Post_08_Feb_18_Info_Graphics_Bar\A1.png; %let file2=C:\Work\Blogs\Graphically Speaking\2016\Post_08_Feb_18_Info_Graphics_Bar\B1.png; %let file3=C:\Work\Blogs\Graphically Speaking\2016\Post_08_Feb_18_Info_Graphics_Bar\C1.png; %let file4=C:\Work\Blogs\Graphically Speaking\2016\Post_08_Feb_18_Info_Graphics_Bar\A2.png; %let file5=C:\Work\Blogs\Graphically Speaking\2016\Post_08_Feb_18_Info_Graphics_Bar\B2.png; /*--Replicate observations by value and School--*/ data Readiness3; /* drop i;*/ format valueLblA ValueLblB percent.; set Readiness; x120=1.2; X0=-0.2; X130=1.3; x270=2.7; start_School=0; start_State=2.5; xmiss=1; /*--Replicate values for "This School"--*/ if school eq 'This School' then do; valueLblA=value; do Val=0.1 to 1 by 0.1; Group='C1'; if Val <= value then Group='A1'; else if Val > value and Val < value+0.099 then Group='A2'; output; valueLblA=.; end; end; else do; /*--Replicate values for "State"--*/ valueLblB=value; do i=0.1 to 1 by 0.1; Group='C1'; if i <= value then Group='B1'; else if i > value and i < value+0.099 then Group='B2'; val=i+1.5; output; valueLblB=.; end; end; run; /*ods html;*/ /*proc print;run;*/ /*ods html close;*/ /*--Create Side by side Infographics--*/ ods graphics / reset width=5in height=2.25in imagename='Readiness_Info' noborder; title j=l h=1 'College Readiness'; proc sgplot data=Readiness3 noborder noautolegend; symbolimage name=A1 image="&file1"; symbolimage name=B1 image="&file2"; symbolimage name=C1 image="&file3"; symbolimage name=A2 image="&file4"; symbolimage name=B2 image="&file5"; styleattrs datasymbols=(A1 A2 C1 B1 B2) datacontrastcolors=(%rgbhex(254, 145, 104) %rgbhex(130, 109, 146)); highlow y=level low=xmiss high=xmiss / type=line group=school lineattrs=(pattern=solid thickness=10) name='a'; scatter y=level x=val / group=group markerattrs=(size=40); text x=x0 y=level text=valueLblA / textattrs=(color=%rgbhex(254, 145, 104) size=9); text x=x270 y=level text=valueLblB / textattrs=(color=%rgbhex(130, 109, 146) size=9); text x=x130 y=level text=level / textattrs=(color=gray size=7) splitchar='.' splitpolicy=splitalways; xaxis display=none max=2.7 offsetmin=0.05 offsetmax=0.0; yaxis display=none reverse splitchar='.' fitpolicy=splitalways splitjustify=center; keylegend 'a' / type=line noborder linelength=10px; run; /*--Append data for headers--*/ data Readiness4; set Readiness3 end=last; output; if last then do; call missing (val, level); xlbl=0.5; text='This School'; output; xlbl=2.05 ; text='State'; output; end; run; /*--Create Graph with Headers--*/ ods graphics / reset width=5in height=2.25in imagename='Readiness_Info_4' noborder; title j=l h=1 'College Readiness'; proc sgplot data=Readiness4 noborder noautolegend; symbolimage name=A1 image="&file1"; symbolimage name=B1 image="&file2"; symbolimage name=C1 image="&file3"; symbolimage name=A2 image="&file4"; symbolimage name=B2 image="&file5"; styleattrs datasymbols=(A1 A2 C1 B1 B2) datacontrastcolors=(%rgbhex(254, 145, 104) %rgbhex(130, 109, 146)); xaxistable text / x=xlbl colorgroup=text location=inside position=top nolabel valueattrs=(weight=bold size=10); scatter y=level x=val / group=group markerattrs=(size=40); text x=x0 y=level text=valueLblA / textattrs=(color=%rgbhex(254, 145, 104) size=9); text x=x270 y=level text=valueLblB / textattrs=(color=%rgbhex(130, 109, 146) size=9); text x=x130 y=level text=level / textattrs=(color=gray size=7) splitchar='.' splitpolicy=splitalways; xaxis display=none max=2.7 offsetmin=0.05 offsetmax=0.0; yaxis display=none reverse splitchar='.' offsetmin=0.1 fitpolicy=splitalways splitjustify=center; keylegend 'a' / type=line noborder linelength=10px; run;