%let gpath='.'; %let dpi=300; ods html close; ods listing style=htmlblue image_dpi=&dpi gpath=&gpath; /*--Define Attribute Map for Fill and data label colors--*/ data attrmap; retain Id 'Severity'; length Value $10 Fillcolor $15 Linecolor $15; input value $ fillcolor $ linecolor $; datalines; Mild lightgreen darkgreen Moderate gold cx9f7f00 Severe lightred darkred ; run; /*--Define Attribute Map to show all colors--*/ data attrmapShowAll; retain Id 'Severity' Show 'Attrmap'; length Value $10 Fillcolor $15 Linecolor $15; input value $ fillcolor $ linecolor $; datalines; Mild lightgreen darkgreen Moderate gold cx9f7f00 Severe lightred darkred ; run; /*--Define some data--*/ data ae; label ae='Adverse Event'; input AE $1-15 Label $16-30 Severity $31-40 low high; datalines; Dizziness Dizziness Moderate 0 3 Dizziness Mild 20 22 Dizziness Mild 26 36 Cough Cough Moderate 18 90 Headache Headache Mild 50 60 Headache Moderate 80 96 Pruritis Pruritis Mild 70 90 ; run; /*--Basic AE graph--*/ ods graphics / reset width=4in height=2in imagename="AE_1"; title "Adverse Event Timeline Graph by Day"; proc sgplot data=ae; highlow y=ae low=low high=high / type=bar group=severity barwidth=0.8 lowlabel=label attrid=Severity labelattrs=(color=black size=9); refline 0 / axis=x; xaxis display=(nolabel) values=(0 to 96 by 2); yaxis display=(noticks novalues); run; title; footnote; /*--AE graph with Discrete Attr Map--*/ ods graphics / reset width=4in height=2in imagename="AE_2"; title "Adverse Event Timeline Graph by Day"; proc sgplot data=ae dattrmap=attrmap; highlow y=ae low=low high=high / type=bar group=severity barwidth=0.8 lowlabel=label attrid=Severity labelattrs=(color=black size=9); refline 0 / axis=x; xaxis display=(nolabel) values=(0 to 96 by 2); yaxis display=(noticks novalues); run; title; footnote; /*--AE graph with all severities--*/ ods graphics / reset width=4in height=2in imagename="AE_3"; title "Adverse Event Timeline Graph by Day"; proc sgplot data=ae dattrmap=attrmapShowAll; highlow y=ae low=low high=high / type=bar group=severity barwidth=0.8 lowlabel=label attrid=Severity labelattrs=(color=black size=9); refline 0 / axis=x; xaxis display=(nolabel) values=(0 to 96 by 2); yaxis display=(noticks novalues); run; title; footnote; /*--AE graph with bigger chicklets--*/ ods graphics / reset width=4in height=2in imagename="AE_4"; title "Adverse Event Timeline Graph by Day"; proc sgplot data=ae dattrmap=attrmapShowAll; highlow y=ae low=low high=high / type=bar group=severity dataskin=pressed barwidth=0.8 lowlabel=label attrid=Severity labelattrs=(color=black size=9); refline 0 / axis=x; xaxis display=(nolabel) values=(0 to 96 by 2); yaxis display=(noticks novalues); keylegend / fillheight=12px fillaspect=golden; run; title; footnote;