ods html close;
%let gpath='C:\';
%let dpi=100;
ods listing style=htmlblue gpath = &gpath image_dpi=&dpi;
data heart;
set sashelp.heart;
if (findw(deathcause, 'Cerebral')) then deathcause='CVD';
if (findw(deathcause, 'Coronary')) then deathcause='CHD';
run;
/*--Cluster BarChart - Heart--*/
ods graphics / reset width=5in height=3in imagename='BarGroupClusterHeart';
title 'Cholesterol by Death Cause and Sex';
proc sgplot data=heart;
format cholesterol 4.0;
vbar deathcause / response=cholesterol group=sex stat=mean nostatlabel
groupdisplay=cluster dataskin=gloss datalabel;
xaxis display=(nolabel);
yaxis grid offsetmin=0;
run;
/*--Cluster BarChart - Cars--*/
ods graphics / reset width=5in height=3in imagename='BarGroupClusterCars';
title 'Mileage by Type and Origin';
proc sgplot data=sashelp.cars;
where type ne 'Hybrid';
format mpg_city 4.0;
vbar type / response=mpg_city group=origin stat=mean nostatlabel
groupdisplay=cluster dataskin=gloss datalabel;
xaxis display=(nolabel);
yaxis grid offsetmin=0;
run;
title;
/*proc print;run;*/
/*--Grouped Box Plot--*/
ods graphics / reset width=5in height=3in imagename='BoxGroupCluster';
title 'Cholesterol by Death Cause';
proc sgplot data=heart;
vbox cholesterol / category=deathcause group=sex clusterwidth=0.5;
xaxis display=(nolabel);
run;
/*ods html close;*/
/*ods listing;*/
/*--Generate grouped box plot data on interval axis--*/
data intervalBoxGroup;
format Date date6.;
drop i;
do Date='01Jan2009'd, '15Jan2009'd,'01Feb2009'd,'15Feb2009'd,
'01Mar2009'd, '01Apr2009'd, '01May2009'd, '01Jun2009'd,
'01Aug2009'd, '01Oct2009'd, '01Dec2009'd;
do i=1 to 10;
Response=rannorm(2); Drug='A'; output;
Response=ranuni(2); Drug='A'; output;
Response=rannorm(2); Drug='B'; output;
Response=ranuni(2); Drug='B'; output;
end;
end;
run;
ods html;
proc print data=intervalBoxGroup(obs=4);run;
ods html close;
/*--Box Plot on Interval Axes--*/
ods graphics / reset width=5in height=3in imagename='BoxInterval';
title '2009 Lab Results by Time';
proc sgplot data=intervalBoxGroup;
format date monname3.;
vbox response / category=date;
xaxis type=time display=(nolabel) values=('01jan09'd to '01dec09'd by month);
yaxis grid display=(nolabel);
run;
/*--Grouped Box Plot on Interval Axes--*/
ods graphics / reset width=5in height=3in imagename='BoxIntervalGroup';
title '2009 Lab Results by Time and Treatment';
proc sgplot data=intervalBoxGroup;
format date monname3.;
vbox response / category=date group=drug groupdisplay=cluster;
xaxis type=linear display=(nolabel) values=('01jan09'd to '01dec09'd by month);
yaxis grid display=(nolabel);
run;
title;
footnote;
/*--Fig3- QTC Mean change from baseline--*/
data QTc_Mean_Group;
input Week Drug $ Mean Low High N;
datalines;
0 A 0 0 0 216
0 B 0 0 0 431
1 A -0.1 -2.0 1.8 210
1 B 0.5 -1.0 2.1 423
2 A -0.6 -2.8 1.8 206
2 B -3.2 -4.8 -1.6 364
4 A 0.4 -1.9 2.4 199
4 B -1.8 -3.6 0.0 362
8 A -1.6 -4.0 0.8 191
8 B -2.8 -4.4 -1.2 337
12 A -3.0 -5.6 -0.4 184
12 B -2.0 -3.6 -0.4 315
16 A -1.2 -3.6 1.2 176
16 B -3.0 -5.0 -1.0 311
20 A -1.6 -4.6 1.4 169
20 B -3.2 -4.8 -1.6 299
24 A -2.2 -5.0 0.6 164
24 B -2.0 -3.8 -0.2 293
28 A -1.6 -3.6 1.0 214
28 B -1.8 -3.2 -0.4 429
;
run;
ods html;
proc print data=QTc_Mean_Group(obs=4);run;
ods html close;
proc format;
value qtcmean
28='LOCF';
;
run;
ods graphics / reset width=5in height=3in imagename='QTc_Mean_SG_V93';
title 'Mean of QTc Change from Baseline';
proc sgplot data=QTc_Mean_Group;
format week qtcmean.;
scatter x=week y=mean / yerrorupper=high yerrorlower=low group=drug
groupdisplay=cluster clusterwidth=0.5 markerattrs=(size=7 symbol=circlefilled);
series x=week y=mean / group=drug groupdisplay=cluster clusterwidth=0.5;
refline 26 / axis=x;
refline 0 / axis=y lineattrs=(pattern=shortdash);
xaxis type=linear values=(1 2 4 8 12 16 20 24 28) max=29 valueshint;
yaxis label='Mean change (msec)' values=(-6 to 3 by 1);
run;
title;
footnote;