/****************************************************************************
* Program/Macro: Figure6
* Lang/Vers: SAS V9.2
* Author: Susan Schwartz - SAS institute
* Date: 12/07/2011
* Program Title: Figure6_LFTTrialDay
* Description:
* This data and code were created by Susan Schwartz at the SAS institute to
* create the graphic. Code from her 2009 paper Schwartz, Susan. 2009
* “Clinical Trial Reporting Using SAS/GRAPH® SG Procedures.” Proceedings of
* the SAS Global Forum 2009 Conference. Cary, NC: SAS Institute Inc.
* Available at http://support.sas.com/resources/papers/proceedings09/174-
2009.pdf.
* The original code from the paper was only the last sgpanel code, the other * code (creating data etc.) came from the online site
* http://support.sas.com/kb/39/192.html
* Edit Log: 7Dec2011 First version complete
* 29Mar2012 General Principles Team comments incorporated
***************************************************************************/
/* Create dataset and patients for graphic. Each row of the dataset has a subject's lab data for a single study day (visit). The 'sday' variable is a numeric value that matches the visit data if the subject was still in the study. If the subject withdrew, the value of 'sday' should be missing. 'sday' is the variable that applies the shaded banding to indicate trial duration.*/
data labs (keep=patient relday sday alat biltot alkph asat miny);
length patient $50;
label alat="ALAT";
label biltot="Bilirubin Total";
label alkph="Alk Phos";
label asat="ASAT";
label relday="Day";
label miny="Trial Duration";
patient="Patient 5152: White Male Age 48; Drug: A";
do relday = -25 to 175 by 25;
alat = 0.5 + 4 * sin(3.14 * (relday+25) / 360.0);
asat = 0.5 + 3 * sin(3.14 * (relday+25) / 400.0);
alkph = 0.4 + 2 * sin(3.14 * (relday+25) / 540.0);
biltot = 0.4 + 1 * sin(3.14 * (relday+25) / 320.0);
miny=-0.5;
sday=relday;
if relday < 0 or relday > 150 then do;
miny = .;
sday=.;
end;
output;
end;
patient="Patient 6416: White Male Age 64; Drug: A";
do relday = -25 to 70 by 15;
alat = 1.5 + 2 * sin(3.14 * (relday+25) / 540.0);
asat = 1.0 + 1 * sin(3.14 * (relday+25) / 540.0);
alkph = 0.5 + 2 * sin(3.14 * (relday+25) / 360.0);
biltot = 1.5 + 1 * sin(3.14 * (relday+25) / 360.0);
miny=-0.5;
sday=relday;
if relday < 0 or relday > 60 then do;
miny = .;
sday=.;
end;
output;
end;
patient="Patient 6850: White Male Age 51; Drug: A";
do relday = -25 to 175 by 25;
alat = 2 + 1 * sin(3.14 * (relday+25) / 90);
asat = 1.2 + 1 * sin(3.14 * (relday+25) / 100);
alkph = 0.7 + 0.5 * sin(3.14 * (relday+25) / 120);
biltot = 0.3 + 0.2 * sin(3.14 * (relday+25) / 110);
miny=-0.5;
sday=relday;
if relday < 0 or relday > 150 then do;
miny = .;
sday=.;
end;
output;
end;
patient="Patient 6969: White Female Age 48; Drug: B";
do relday = -25 to 175 by 25;
alat = 0.5 + 1.5 * sin(3.14 * (relday+25) / 540);
asat = 0.6 + 1.2 * sin(3.14 * (relday+25) / 480);
alkph = 0.7 + 1 * sin(3.14 * (relday+25) / 600);
biltot = 0.3 + 1 * sin(3.14 * (relday+25) / 500);
miny=-0.5;
sday=relday;
if relday < 0 or relday > 150 then do;
miny = .;
sday=.;
end;
output;
end;
run;
/* Graph the data using html. Plot 4 panels (one for each subject) with all lab tests for each subject. A shaded band indicates the trial duration for each subject. */
ods listing close;
ods html file='riskpanel.html' path='.' style=statistical ;
ods graphics / reset width=800px height=600px imagename='RiskPanel' imagefmt=gif ;
title "Liver Function Tests by Trial Day: At Risk Subjects";
footnote1 ' ';
footnote2 j=l italic height=8pt
" For ALAT, ASAT and Alkaline Phosphatase, the Clinical Concern Level is 2 xULN;";
footnote3 j=l italic height=8pt
" For Bilirubin Total, the CCL is 1.5 xULN: "
"where ULN is the Upper Level of Normal";
footnote4 j=l italic height=8pt
j=l italic height=8pt
" Shaded region indicates time on treatment.";
proc sgpanel data=labs cycleattrs;
panelby patient / novarname;
series x=relday y=alat / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=solid);
series x=relday y=asat / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=shortdash);
series x=relday y=alkph / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=longdash);
series x=relday y=biltot / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=dot);
band x=sday lower=miny upper=4.5 / transparency=0.8 legendlabel='On Treatment';
refline 1 1.5 2 / axis=Y lineattrs=(pattern=dash);
colaxis min=-50 max= 200 offsetmin=.1 display=(nolabel);
colaxis label="Study Day";
rowaxis label="Upper Limit Normal";
run;
ods html close;
ods listing;
/*The below code will output the graphic to an rtf file at a specified location and was added in addition to the original code above created by Susan Schwartz */
options orientation=landscape;
goptions reset=global;
goptions reset=all device=PNG target=PNG
xmax = 10 in xpixels=2000
ymax = 7 in ypixels=1400;
ods listing close;
ods rtf file='Location and file name.rtf' style=rtf;
title "Liver Function Tests by Trial Day: At Risk Subjects";
footnote1 ' ';
footnote2 j=l italic height=8pt
" For ALAT, ASAT and Alkaline Phosphatase, the Clinical Concern Level is 2 xULN;";
footnote3 j=l italic height=8pt
" For Bilirubin Total, the CCL is 1.5 xULN: "
"where ULN is the Upper Level of Normal";
footnote4 j=l italic height=8pt
j=l italic height=8pt
" Shaded region indicates time on treatment.";
proc sgpanel data=labs cycleattrs;
panelby patient / novarname;
series x=relday y=alat / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=solid);
series x=relday y=asat / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=shortdash);
series x=relday y=alkph / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=longdash);
series x=relday y=biltot / markers markerattrs=(size=10)
lineattrs=(thickness=2px pattern=dot);
band x=sday lower=miny upper=4.5 / transparency=0.8 legendlabel='On Treatment';
refline 1 1.5 2 / axis=Y lineattrs=(pattern=dash);
colaxis min=-50 max= 200 offsetmin=.1 display=(nolabel);
colaxis label="Study Day";
rowaxis label="Upper Limit Normal";
run;
ods rtf close;
ods listing;