%let gpath='C:\Work\Blogs\Graphically Speaking\2014\Post_June_08_BulletPanel'; %let dpi=200; ods html close; ods listing gpath=&gpath image_dpi=&dpi; /*--Data for lipid gradient panel--*/ data Lipid_Panel; input test $1-20 value units $25-34 V1 V2 V3 V4 V5 Vn rev; length LVn1 LVn2 LVn3 LVn4 LVn5 $4; /*--Data for Test Name--*/ NameL=-50; NameH=-50; /*--Data for value box--*/ boxL=-20; boxH=-5; boxM=-14; name=test; /*--Actual and normalized data and labels--*/ if rev=0 then do; Vn1=5; Vn2=25; Vn3=50; Vn4=75; Vn5=95; Vnl=3; Vnh=97; LVn1='Low'; LVn2='25%'; LVn3='50%'; LVn4='75%'; LVn5='High'; end; else do; vn=100-vn; Vn5=5; Vn4=25; Vn3=50; Vn2=75; Vn1=95; Vnl=97; Vnh=3; LVn1='Low'; LVn2='25%'; LVn3='50%'; LVn4='75%'; LVn5='High'; end; low=0; /*--Data for gradient band--*/ do id=0 to 99; high=low+1; output; low=low+1; call missing(value, vn, boxL, boxH, Vn1, Vn2, Vn3, Vn4, Vn5, Vnl, Vnh, LVn1, LVn2, LVn3, LVn4, LVn5, namel, nameh, name, units); end; datalines; Large VLDL-P 8.2 nmol/L 0 0.9 2.7 6.9 10 85.5 0 Small LDL-P 830 nmol/L 0 117 527 830 1200 75.0 0 Large HDL-P 2.7 mumol/L 1.5 3.1 4.8 7.3 11 18.8 1 VLDL Size 50.4 nm 35 42.4 43.5 52.5 80 69.2 0 LDL Size 20.4 nm 19 20.4 20.8 21.1 22 25.0 1 HDL Size 8.7 nm 12 9.8 9.2 9.0 7.9 18.2 1 LP-IR Score 84 0-100 0 27 45 63 100 89.2 0 ; run; /**/ /*ods html;*/ /*proc print data=Lipid_Panel;*/ /* var test value vn rev V1 V2 V3 V4 V5;*/ /*run;*/ /*ods html close;*/ /*--Create Darker Color Ramp attr map--*/ data RampMapDarker; length fillcolor $8; keep id value fillcolor; id='YellowRed'; gs=127; rs=0; b=0; step=224/50; step2=(224-127)/50; do i=0 to 49; value=i; r=rs+floor(step*i); g=gs+floor(step2*i); fillcolor="CX" || put(r,hex2.) || put(g,hex2.) || put(b,hex2.); output; end; gs=g; rs=r; do i=0 to 49; value=i+50; r=rs-floor(step2*i); g=gs-floor(step*i); fillcolor="CX" || put(r,hex2.) || put(g,hex2.) || put(b,hex2.); output; end; run; /*--Lipid panel with values iat marker--*/ ods graphics / reset width=5in height=3.5in imagename='Lipid_Dashboard_Grad_Label_93'; title 'Lipid Panel for Subject XXX-XX-XXXX'; proc sgplot data=Lipid_Panel noautolegend dattrmap=RampMapDarker; highlow y=test low=low high=high / type=bar group=id nooutline attrid=YellowRed barwidth=0.6 ; hbarparm category=test response=vn / barwidth=0.2 fillattrs=(color=gray) nooutline ; scatter y=test x=vn2 / markerchar=v2 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vn3 / markerchar=v3 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vn4 / markerchar=v4 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vnl / markerchar=lvn1 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn2 / markerchar=lvn2 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn3 / markerchar=lvn3 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn4 / markerchar=lvn4 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vnh / markerchar=lvn5 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn / markerattrs=(symbol=trianglefilled size=10) discreteoffset=0.2; scatter y=test x=vn / markerchar=value discreteoffset=0.45 markercharattrs=(size=8 weight=bold); xaxis display=none offsetmin=0 offsetmax=0; yaxis display=(nolabel noticks noline); run; /*--Lipid panel with values in box--*/ ods graphics / reset width=5in height=3.5in imagename='Lipid_Dashboard_Grad_Box_93'; title 'Lipid Panel for Subject XXX-XX-XXXX'; proc sgplot data=Lipid_Panel noautolegend dattrmap=RampMapDarker; highlow y=test low=nameL high=nameH / type=bar nooutline barwidth=0.6 fillattrs=(color=white) highlabel=name; highlow y=test low=boxL high=boxH / type=bar nofill outline lineattrs=(color=black) barwidth=0.6; scatter y=test x=boxM / markerchar=value discreteoffset=0 markercharattrs=(size=8 weight=bold); scatter y=test x=boxM / markerchar=units discreteoffset=-0.4 markercharattrs=(size=7 color=gray); highlow y=test low=low high=high / type=bar group=id nooutline attrid=YellowRed barwidth=0.6 ; highlow y=test low=low high=high / type=bar group=id nooutline attrid=YellowRed barwidth=0.6 ; hbarparm category=test response=vn / barwidth=0.2 fillattrs=(color=gray) dataskin=gloss; scatter y=test x=vn2 / markerchar=v2 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vn3 / markerchar=v3 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vn4 / markerchar=v4 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vnl / markerchar=lvn1 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn2 / markerchar=lvn2 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn3 / markerchar=lvn3 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn4 / markerchar=lvn4 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vnh / markerchar=lvn5 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn / markerattrs=(symbol=trianglefilled size=10) discreteoffset=0.2; xaxis display=none offsetmin=0 offsetmax=0; yaxis display=none; run; /*--Annotations--*/ data anno; length label $132 function $12; function='Text'; Label='Lipoprotein Markers Associated with Insulin Resistance and Diabetes Risk'; textsize=7; width=30; x1space='LayoutPercent'; y1space='GraphPercent'; x1=0; y1=100; textcolor='red'; anchor='topleft'; output; call missing (label, textsize, width, widthunit, textcolor, anchor); function='Text'; Label='Insulin Sensitive'; textsize=7; width=30; x1space='datavalue'; y1space='GraphPercent'; x1=0; y1=100; textcolor='black'; anchor='topleft'; output; call missing (label, textsize, width, widthunit, textcolor, anchor); function='Text'; Label='Insulin Resistant'; textsize=7; width=30; x1space='datavalue'; y1space='GraphPercent'; x1=77; y1=100; textcolor='black'; anchor='topleft'; output; call missing (label, textsize, width, widthunit, textcolor, anchor); function='Text'; Label='Percentile in Reference Population'; textsize=7; width=40; x1space='datavalue'; y1space='GraphPercent'; x1=50; y1=93; textcolor='black'; anchor='center'; output; call missing (label, textsize, width, widthunit, textcolor, anchor); function='Arrow'; x1space='datavalue'; x2space='datavalue'; y1space='GraphPercent'; y2space='GraphPercent'; x2=0; y2=96; x1=100; y1=96; output; run; proc print;run; /*--Lipid panel with Anno--*/ title; footnote j=l h=7pt 'LP-IR Score is inaccurate if subject is non-fasting'; ods graphics / reset width=5in height=4in imagename='Lipid_Dashboard_Grad_Anno_93'; proc sgplot data=Lipid_Panel noautolegend dattrmap=RampMapDarker pad=(top=12pct) sganno=anno; highlow y=test low=nameL high=nameH / type=bar nooutline barwidth=0.6 fillattrs=(color=white) highlabel=name; highlow y=test low=boxL high=boxH / type=bar nofill outline lineattrs=(color=black) barwidth=0.6; scatter y=test x=boxM / markerchar=value discreteoffset=0 markercharattrs=(size=7 weight=bold); scatter y=test x=boxM / markerchar=units discreteoffset=-0.4 markercharattrs=(size=7 color=gray); highlow y=test low=low high=high / type=bar group=id nooutline attrid=YellowRed barwidth=0.6 ; highlow y=test low=low high=high / type=bar group=id nooutline attrid=YellowRed barwidth=0.6 ; hbarparm category=test response=vn / barwidth=0.2 fillattrs=(color=gray) nooutline dataskin=gloss; scatter y=test x=vn2 / markerchar=v2 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vn3 / markerchar=v3 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vn4 / markerchar=v4 markercharattrs=(color=white size=7 weight=normal); scatter y=test x=vnl / markerchar=lvn1 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn2 / markerchar=lvn2 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn3 / markerchar=lvn3 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn4 / markerchar=lvn4 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vnh / markerchar=lvn5 markercharattrs=(size=7 color=gray) discreteoffset=-0.4; scatter y=test x=vn / markerattrs=(symbol=trianglefilled size=10) discreteoffset=0.2; xaxis display=none offsetmin=0 offsetmax=0; yaxis display= none; run; footnote;