%let gpath=C:\; ods html close; %let w=4in; %let h=2.5in; %let dpi=200; ods listing style=journal2 gpath="&gpath" image_dpi=&dpi; data cars; set sashelp.cars (where=(type ne 'Hybrid')); run; /*--Bar Chart--*/ ods graphics / reset width=5in height=3in imagename='Bar'; title 'Mileage by Type and Origin'; proc sgplot data=cars noborder; vbar type / response=mpg_city stat=mean group=origin groupdisplay=cluster displaybaseline=auto clusterwidth=0.7; yaxis display=(noline noticks nolabel) grid; xaxis display=(noline noticks nolabel); run; /*--Band Plot--*/ ods graphics / reset width=5in height=3in imagename='Band'; title 'Stock Range'; proc sgplot data=sashelp.stocks(where=(date > '01Apr2003'd and stock ne 'IBM')) noborder; band x=date upper=high lower=low / group=stock nofill fillpattern outline lineattrs=graphdata1; yaxis display=(noline noticks nolabel) grid; xaxis display=(noline noticks nolabel) grid; run; /*--Bubble Plot--*/ ods graphics / reset width=5in height=3in imagename='Bubble'; title; proc sgplot data=sashelp.class noborder; bubble x=height y=weight size=age / group=sex nofill fillpattern outline lineattrs=graphdata1; inset "Bubble Size is by Age" / position=bottomright border; keylegend / location=inside position=topleft border autoitemsize; yaxis display=(noline noticks) grid; xaxis display=(noline noticks) grid; run; /*--Ellipse Plot--*/ ods graphics / reset width=5in height=3in imagename='Ellipse'; proc sgplot data=sashelp.cars(where=(origin ne 'Europe')) noborder; styleattrs datafillpatterns=(l1 r1); ellipse x=horsepower y=mpg_city / group=origin nofill fillpattern outline lineattrs=graphdata1; keylegend / location=inside position=topright border autoitemsize across=1; yaxis display=(noline noticks) label='Mileage' grid; xaxis display=(noline noticks) label='Horsepower' grid; run; /*--HighLow Plot Data--*/ proc means data=sashelp.cars(where=(origin ne 'Europe' and type ne 'Hybrid')); class origin type; var mpg_city mpg_highway; output out=carmeans(where=(_type_ > 2)) Mean(mpg_city)=City Mean(mpg_highway)=Highway; run; /*--HighLow Plot--*/ ods graphics / reset width=5in height=3in imagename='HighLow'; title 'Mean City and Highway Mileage by Type and Origin'; proc sgplot data=carmeans noborder; format city highway 4.1; styleattrs datafillpatterns=(l1 r1); highlow y=type low=city high=highway / group=origin type=bar groupdisplay=cluster nofill fillpattern outline lineattrs=graphdata1 lowlabel=city highlabel=highway clusterwidth=0.6; keylegend / autoitemsize; yaxis display=(noline noticks nolabel) ; xaxis display=(noline noticks) label='Mileage' grid; run; /*--Histogram Plot--*/ ods graphics / reset width=5in height=3in imagename='Histogram'; title 'Distribution of Mileage by Origin'; proc sgplot data=sashelp.cars(where=(origin ne 'Europe' and type ne 'Hybrid')) noborder; styleattrs datafillpatterns=(l1 r1); histogram mpg_city / group=origin nbins=20; keylegend / autoitemsize location=inside across=1 position=topright; yaxis display=(noline noticks nolabel) ; xaxis display=(noline noticks) label='Mileage' max=40; run; /*--VBox Plot--*/ ods graphics / reset width=5in height=3in imagename='Box'; title 'Distribution of Mileage by Type and Origin'; proc sgplot data=sashelp.cars(where=(origin ne 'Europe' and type ne 'Hybrid')) noborder; /* styleattrs datafillpatterns=(l1 r1);*/ vbox mpg_city / category=type group=origin nofill fillpattern groupdisplay=cluster whiskerattrs=(pattern=solid); keylegend / autoitemsize location=inside across=1 position=topright; yaxis display=(noline noticks nolabel) ; xaxis display=(noline noticks); run; data polygons; input Id Group $ X Y; datalines; 1 M 1 1 1 M 2 1 1 M 2 2 1 M 1 2 2 F 3 1.5 2 F 4 1.5 2 F 3.5 2.5 ; run; /*--Polygon Plot--*/ ods graphics / reset width=5in height=3in imagename='Polygon'; title 'Shapes by Gender'; proc sgplot data=polygons noborder aspect=0.6; styleattrs datafillpatterns=(l1 x1); polygon id=id x=x y=y / group=group nofill fillpattern lineattrs=(pattern=solid); keylegend / autoitemsize; yaxis display=(noline noticks nolabel) min=0 max=3 values=(0 to 3 by 1) grid; xaxis display=(noline noticks nolabel) min=0 max=5 grid; run; /*--Polygon Plot with fill, fillpatterhs and skin--*/ ods listing style=htmlblue; ods graphics / reset width=5in height=3in imagename='Polygon_Skin'; title 'Shapes by Gender'; proc sgplot data=polygons noborder aspect=0.6; styleattrs datafillpatterns=(l1 x1); polygon id=id x=x y=y / group=group fill fillpattern dataskin=sheen; keylegend / autoitemsize; yaxis display=(noline noticks nolabel) min=0 max=3 values=(0 to 3 by 1) grid; xaxis display=(noline noticks nolabel) min=0 max=5 grid; run; title; footnote;