%let gpath='.';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Create weekly chart using cars--*/
data ValueByWeek;
set sashelp.cars;
keep Week Value Location;
Value=mpg_city;
Location=Origin;
select (type);
when ('Hybrid') Week=1;
when ('SUV') Week=2;
when ('Sedan') Week=3;
when ('Sports') Week=4;
when ('Truck') Week=5;
when ('Wagon') Week=6;
otherwise;
end;
run;
proc sort data=ValueByWeek;
by week;
run;
/*--Graph of Box Plot with connect by Q1 and Q3--*/
ods listing style=htmlblue;
ods graphics / reset width=5in height=3in imagename='BoxConnect';
title 'Distribution of Value by Week';
proc sgplot data=ValueByWeek nocycleattrs noautolegend;
vbox value / category=week connect=q1 connectattrs=(color=cxa0a0b0);
vbox value / category=week nofill connect=q3 connectattrs=(color=cxa0a0b0);
xaxis display=(nolabel);
run;
/*--Graphs of Box Plot with connect by Q1 and Q3 by Origin--*/
ods listing style=curve;
ods graphics / reset width=3.5in height=5in imagename='BoxConnectPanel';
title 'Distribution of Value by Week';
proc sgpanel data=ValueByWeek nocycleattrs noautolegend;
panelby location / layout=panel columns=1;
vbox value / category=week connect=q1 connectattrs=(color=cxa0a0a0);
vbox value / category=week nofill connect=q3 connectattrs=(color=cxa0a0a0);
colaxis display=(nolabel);
run;
proc sort data=ValueByWeek;
by location;
run;
/*--Graphs of Box Plot with connect by Q1 and Q3 by Origin--*/
ods listing style=analysis;
ods graphics / reset width=5in height=3in imagename='BoxConnectBy';
title 'Distribution of Value by Week';
proc sgplot data=ValueByWeek nocycleattrs noautolegend uniform=xscale;
by location;
vbox value / category=week connect=q1 connectattrs=(color=cxa0b0a0);
vbox value / category=week nofill connect=q3 connectattrs=(color=cxa0b0a0);
xaxis display=(nolabel);
run;