%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; 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; /*ods html;*/ /*proc print data=attrmap; */ /* var id value fillcolor linecolor;*/ /*run;*/ /**/ /*proc print data=attrmapShowAll; */ /* var id value show fillcolor linecolor;*/ /*run;*/ /*ods html close;*/ 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; /*--AE graph--*/ 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 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; /*--Stacked Bar Chart--*/ ods graphics / reset width=4in height=3in imagename="Bar_1"; title "Counts by Type and Origin"; proc sgplot data=sashelp.cars nowall noborder; vbar type / group=origin dataskin=gloss filltype=gradient baselineattrs=(thickness=0); keylegend / location=inside across=1 position=topright opaque fillheight=12px fillaspect=golden; xaxis display=(noline noticks nolabel); yaxis display=(noline nolabel noticks) grid; run; /*--Stacked Bar Chart Reverse--*/ ods graphics / reset width=4in height=3in imagename="Bar_2"; title "Counts by Type and Origin"; proc sgplot data=sashelp.cars nowall noborder; vbar type / group=origin dataskin=gloss filltype=gradient baselineattrs=(thickness=0) grouporder=reversedata; keylegend / location=inside across=1 position=topright opaque fillheight=12px fillaspect=golden; xaxis display=(noline noticks nolabel); yaxis display=(noline nolabel noticks) grid; run; /*--Discrete Arrt Map for Legend--*/ data CarsShowAll; retain Id 'Origin' Show 'Attrmap'; length Value $10 FillStyleElement $15; input value $ FillStyleElement $; datalines; USA graphdata3 Europe graphdata2 Asia graphdata1 ; run; ods html; proc print;run; ods html close; /*--Stacked Bar Chart with AttrMap--*/ ods graphics / reset width=4in height=3in imagename="Bar_3"; title "Counts by Type and Origin"; proc sgplot data=sashelp.cars dattrmap=carsShowAll nowall noborder; vbar type / group=origin dataskin=gloss filltype=gradient baselineattrs=(thickness=0) attrid=Origin;; keylegend / location=inside across=1 position=topright opaque fillheight=12px fillaspect=golden; xaxis display=(noline noticks nolabel); yaxis display=(noline nolabel noticks) grid; run; proc print data=sashelp.cars;run;