ods html close;
%let gpath='C:\';
%let dpi=100;
ods listing gpath = &gpath image_dpi=&dpi;
data revenue;
input Year Revenue Shipment;
label Shipment="Shipment (in Tons)";
format Revenue dollar8.0;
datalines;
2005 25000 300
2006 27000 350
2007 30000 370
2008 25000 310
2009 20000 250
;
run;
ods html style=htmlblue;
proc print noobs;run;
ods html close;
/*--Bar Line Graph - 1--*/
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_1';
title 'Revenue by Year';
proc sgplot data=revenue;
vbar year / response=revenue stat=mean nostatlabel;
xaxis display=(nolabel);
yaxis grid;
run;
title;
/*--Bar Line Graph - 2--*/
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_2';
title 'Revenue and Shipment by Year';
proc sgplot data=revenue;
vbar year / response=revenue stat=mean nostatlabel;
vline year / response=shipment stat=mean nostatlabel;
xaxis display=(nolabel);
yaxis grid;
run;
title;
/*--Bar Line Graph - 3--*/
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_3';
title 'Revenue and Shipment by Year';
proc sgplot data=revenue;
vbar year / response=revenue stat=mean nostatlabel;
vline year / response=shipment stat=mean nostatlabel y2axis;
xaxis display=(nolabel);
yaxis grid offsetmin=0;
run;
title;
/*--Bar Line Graph - 5--*/
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_5';
title 'Revenue and Shipment by Year';
proc sgplot data=revenue;
vbar year / response=revenue stat=mean nostatlabel;
vline year / response=Shipment stat=mean nostatlabel y2axis
lineattrs=(thickness=10) transparency=0.3;
xaxis display=(nolabel);
yaxis grid offsetmin=0 values=(0 to 30000 by 5000);
y2axis offsetmin=0 values=(0 to 480 by 80);
run;
title;
proc template;
define style datafont;
parent = Styles.listing;
style GraphFonts from GraphFonts /
'GraphDataFont' = (", ",10pt) ;
end;
run;
/*--Bar Line Graph - 6--*/
ods listing style=datafont;
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_6';
title 'Revenue and Shipment by Year';
proc sgplot data=revenue;
vbar year / response=revenue stat=mean nostatlabel datalabel;
vline year / response=Shipment stat=mean nostatlabel y2axis datalabel=shipment
lineattrs=graphdata1(thickness=10) transparency=0.3;
xaxis display=(nolabel);
yaxis grid offsetmin=0 values=(0 to 30000 by 5000) display=(nolabel novalues noticks);
y2axis offsetmin=0 values=(0 to 480 by 80) display=(nolabel novalues noticks);
keylegend / location=inside position=topright across=1;
run;
title;
/*--Bar Line Graph - GTL-1--*/
proc template;
define statgraph Bar_line_1;
begingraph;
entrytitle 'Revenue and Shipment by Year';
layout overlay / xaxisopts=(display=(ticks tickvalues))
yaxisopts=(griddisplay=on offsetmin=0 offsetmax=0.1 display=none linearopts=
(tickvaluesequence=(start=0 end=35000 increment=5000)))
y2axisopts=(offsetmin=0 offsetmax=0.1 display=none linearopts=
(tickvaluepriority=true tickvaluesequence=(start=0 end=480 increment=80)));
barchart x=year y=revenue / barlabel=true name='a';
barchart x=year y=Shipment / barlabel=true yaxis=y2 datatransparency=1;
seriesplot x=year y=Shipment / yaxis=y2 name='b'
lineattrs=graphdata1(thickness=10) datatransparency=0.3;
discretelegend 'a' 'b' / location=inside valign=top halign=right across=1;
endlayout;
endgraph;
end;
run;
ods listing style=datafont;
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_GTL_1';
proc sgrender data=revenue template=Bar_line_1;
run;
/*--Bar Line Graph - GTL-2--*/
proc template;
define statgraph Bar_line_2;
begingraph;
entrytitle 'Revenue and Shipment by Year';
layout overlay / xaxisopts=(display=(ticks tickvalues))
yaxisopts=(griddisplay=on offsetmax=0.15 offsetmin=0 display=none linearopts=
(tickvaluesequence=(start=0 end=35000 increment=5000)))
y2axisopts=(offsetmin=0 offsetmax=0.15 display=none linearopts=
(tickvaluepriority=true tickvaluesequence=(start=0 end=480 increment=80)));
barchart x=year y=revenue / barlabel=true name='a' skin=modern;
barchart x=year y=Shipment / barlabel=true yaxis=y2 datatransparency=1;
seriesplot x=year y=Shipment / yaxis=y2 name='b'
lineattrs=graphdata1(thickness=10) datatransparency=0.3;
scatterplot x=year y=Shipment / yaxis=y2
markerattrs=graphdata1(symbol=circlefilled size=15);
scatterplot x=year y=Shipment / yaxis=y2
markerattrs=(symbol=circlefilled size=11 color=white);
discretelegend 'a' 'b' / location=inside valign=top halign=right across=1;
endlayout;
endgraph;
end;
run;
ods listing style=datafont;
ods graphics / reset width=5in height=3.0in imagename='Bar_Line_GTL_2';
proc sgrender data=revenue template=Bar_line_2;
run;