FOCUS AREAS

Graphics

Mileage by Horsepower by Type
Base SAS: ODS Graphics Procedure: SGPLOT

%let gpath='.';
%let car='./Car_Trans.png';
%let truck='./Truck_Trans.png';
%let dpi=100;

ods html close;
ods listing gpath=&gpath image_dpi=&dpi;

/*--Adjust data--*/
data cars;
  set sashelp.cars(where=(make in ('BMW', 'Porsche') and horsepower > 300 and 
                          horsepower < 350 and MSRP > 50000));
  keep make horsepower mpg_city;
  horsepower=horsepower*(1+0.11*ranuni(3));
  mpg_city=mpg_city*(1-0.05*ranuni(3));
  if make='BMW' and horsepower > 347 then horsepower+5;
  if make='BMW' and mpg_city > 17.4 then mpg_city+1;
  if make='BMW' and horsepower < 335 then mpg_city=mpg_city-0.5;
run;

/*--Scatter Plot with Image Symbols 9.4--*/
ods listing style=htmlblue;
ods graphics / reset attrpriority=none noborder width=5in height=3.75in imagename='Symbols_Image_94';
title 'Mileage by Horsepower by Type'; 
footnote j=l 'Symbols from Image';
proc sgplot data=cars noautolegend;
  symbolimage name=BMW image=&car / scale=1;
  symbolimage name=Porsche image=&truck / scale=1;
  styleattrs datasymbols=(BMW Porsche);
  scatter x=horsepower y=mpg_city / group=make markerattrs=(size=80);
  yaxis grid integer offsetmin=0.1 offsetmax=0.1;
  xaxis grid ;
  run;

title;
footnote;