ods html close;
%let gpath='C:\';
%let dpi=200;
ods listing style=htmlblue image_dpi=&dpi gpath=&gpath;
data QTc_Mean_Group;
input Week Drug $ Mean Low High N;
if week ne 28 then mean2=mean;
if week eq 2 then do; ylabel='C'; label='Number of subjects at visit'; end;
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;
/*--Format for the week variable--*/
proc format;
value qtcmean
28='LOCF';
;
run;
/*--QTc Graph only--*/
ods graphics / reset width=5in height=3in imagename='QTc_Mean_SG_Basic';
footnote j=l h=0.8 "Note: Vertical lines represent 95% confidence intervals. LOCF is last observation carried forward";
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=mean2 / group=drug groupdisplay=cluster clusterwidth=0.5;
refline 26 / axis=x;
refline 0 / axis=y lineattrs=(pattern=shortdash);
xaxis type=linear values=(0 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;
/*--QTc Graph witn internal AtRisk Table--*/
ods graphics / reset width=5in height=3in imagename='QTc_Mean_SG_InnerTable';
footnote j=l h=0.8 "Note: Vertical lines represent 95% confidence intervals. LOCF is last observation carried forward";
proc sgplot data=QTc_Mean_Group;
format week qtcmean.;
format n 3.0;
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=mean2 / group=drug groupdisplay=cluster clusterwidth=0.5;
scatter x=week y=ylabel / markerchar=label y2axis markercharattrs=(size=6 weight=bold);
scatter x=week y=drug / group=drug markerchar=n y2axis markercharattrs=(size=6 weight=bold);
refline 26 / axis=x;
refline 0 / axis=y lineattrs=(pattern=shortdash);
refline -6.25 / axis=y;
xaxis type=linear values=(0 1 2 4 8 12 16 20 24 28) max=29 valueshint offsetmin=0.05 offsetmax=0.05;
yaxis label='Mean change (msec)' values=(-6 to 3 by 1) offsetmin=0.18;
y2axis display=none offsetmin=0.88 reverse;
run;
title;
footnote;
/*--Anno data set--*/
ods escapechar '~';
data anno;
retain function 'text' y1space 'graphpercent';
retain textsize 6;
length textcolor $25 label $100 x1space $12 textweight $6;
drop week n drug;
set QTc_Mean_Group(keep=week n drug) end=last;
width=10; anchor='center'; x1space='datavalue'; textweight='bold';
label=put(n, 5.0);
y1=6; textcolor='GraphData2:contrastcolor';
if drug='A' then do; y1=9; textcolor='Graphdata1:contrastcolor'; end;
x1=week;
if last then do;
output;
x1=2; y1=6; textcolor='Graphdata2:contrastcolor'; width=10; label='Drug B'; x1space='graphpercent';
anchor='left'; textsize=6; textweight='bold'; output;
x1=2; y1=9; textcolor='Graphdata1:contrastcolor'; width=10; label='Drug A'; x1space='graphpercent';
anchor='left'; textsize=6; textweight='bold'; output;
x1=0; y1=13; textcolor=''; width=40; label='Number of subjects at visit'; x1space='datavalue';
anchor='left'; textsize=8; textweight='normal'; output;
x1=2; y1=2; textcolor=''; width=100; x1space='graphpercent';
label='Note: Vertical lines represent 95% confidence intervals. LOCF is last observation carried forward';
anchor='left'; textsize=8; textstyle='italic'; textweight='normal'; output;
end;
else output;
;
run;
/*--QTc Graph witn internal AtRisk Table--*/
ods graphics / reset width=5in height=3in imagename='QTc_Mean_SG_OuterTable_V93';
/*footnote j=l "Note: Vertical lines represent 95% confidence intervals. LOCF is last observation carried forward";*/
proc sgplot data=QTc_Mean_Group sganno=anno pad=(bottom=14%);
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=mean2 / group=drug groupdisplay=cluster clusterwidth=0.5;
refline 26 / axis=x;
refline 0 / axis=y lineattrs=(pattern=shortdash);
xaxis type=linear values=(0 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;