%let gpath=C:\;
ods html close;
%let w=5in;
%let h=3in;
%let dpi=200;
ods listing style=htmlblue gpath="&gpath" image_dpi=&dpi;
/*--Create some data--*/
data sales;
format Margin percent5.0;
input Month $ Year $6-15 Sales Margin;
datalines;
Jan This Year 2.0 .
Jan Last Year 2.5 0.35
Feb This Year 2.5 .
Feb Last Year 2.7 0.39
Mar This Year 2.6 .
Mar Last Year 3.2 0.42
Apr This Year 3.2 .
Apr Last Year 3.0 0.44
May This Year 2.4 .
May Last Year 3.1 0.42
Jun This Year 2.7 .
Jun Last Year 3.2 0.425
Jul This Year 2.9 .
Jul Last Year 2.62 0.40
Aug This Year 3.0 .
Aug Last Year 3.1 0.44
;
run;
/*--Bar--*/
ods graphics / reset attrpriority=color width=&w height=&h imagename='Bar';
title 'Sales by Month';
proc sgplot data=sales noborder;
vbar month / response=Sales baselineattrs=(thickness=0) datalabel nostatlabel;
xaxis discreteorder=data display=(noline nolabel noticks);
yaxis display=(noline noticks) grid label='(in Million $)';
run;
/*--Bar-Line--*/
ods graphics / reset attrpriority=color width=&w height=&h imagename='Bar_Line';
title 'Sales and Margin by Month';
proc sgplot data=sales noborder;
vbar month / response=Sales dataskin=pressed baselineattrs=(thickness=0) name='a' nostatlabel;
vline month / response=margin y2axis lineattrs=(color=gold thickness=4) nostatlabel name='b';
xaxis discreteorder=data display=(noline nolabel noticks);
yaxis display=(noline noticks) grid label='(in Million $)' values=(0 to 6 by 1) offsetmin=0;
y2axis display=(noline noticks) values=(0.34 to 0.46 by 0.02) offsetmin=0;
keylegend 'a' 'b' / title='' linelength=24;
run;
/*--Bar Stack Line--*/
ods graphics / reset attrpriority=color width=&w height=&h imagename='Bar_Stack_Line';
title 'Sales and Margin by Month';
proc sgplot data=sales noborder;
vbar month / response=Sales group=year groupdisplay=stack dataskin=pressed
baselineattrs=(thickness=0) name='a';
vline month / response=margin group=year y2axis lineattrs=(color=gold thickness=4) nostatlabel name='b';
xaxis discreteorder=data display=(noline nolabel noticks);
yaxis display=(noline noticks) grid label='(in Million $)' values=(0 to 6 by 1) offsetmin=0;
y2axis display=(noline noticks) values=(0.34 to 0.46 by 0.02) offsetmin=0;
keylegend 'a' 'b' / title='' linelength=24;
run;
/*--Bar Stack Line Parm--*/
ods graphics / reset attrpriority=color width=&w height=&h imagename='Bar_Stack_Line_Parm';
title 'Sales and Margin by Month';
proc sgplot data=sales noborder;
vbarparm category=month response=Sales / group=year groupdisplay=stack dataskin=pressed
baselineattrs=(thickness=0) name='a';
series x=month y=margin / y2axis lineattrs=(color=gold thickness=4) name='b';
xaxis discreteorder=data display=(noline nolabel noticks);
yaxis display=(noline noticks) grid label='(in Million $)' values=(0 to 6 by 1) offsetmin=0;
y2axis display=(noline noticks) values=(0.34 to 0.46 by 0.02) offsetmin=0;
keylegend 'a' 'b' / title='' linelength=24;
run;
/*--Bar Cluster Line Parm--*/
ods graphics / reset attrpriority=color width=&w height=&h imagename='Bar_Cluster_Line_Parm';
title 'Sales and Margin by Month';
proc sgplot data=sales noborder;
vbarparm category=month response=Sales / group=year groupdisplay=cluster
dataskin=pressed baselineattrs=(thickness=0) name='a';
series x=month y=margin / y2axis lineattrs=(color=gold thickness=4) name='b';
xaxis discreteorder=data display=(noline nolabel noticks);
yaxis display=(noline noticks) grid label='(in Million $)' values=(0 to 3 by 0.5) offsetmin=0;
y2axis display=(noline noticks) values=(0.34 to 0.46 by 0.02) offsetmin=0;
keylegend 'a' 'b' / title='' linelength=24;
run;