FOCUS AREAS

Graphics

Hazard Function for Adverse Events of Special Interest
Base SAS: ODS Graphics Procedure: SGPLOT

%let gpath='.';
%let dpi=100;

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

data hazard;
  input day A ALow AHigh ARisk B BLow BHigh BRisk;
  label day='Days since Randomization';
  label A='Drug A';
  label B='Drug B';
  label ARisk='Drug A';
  label BRisk='Drug B';
  datalines;
 0   .      .      .      .    .      .      .       . 
10   .0005  .0001  .0009  212  .0078  .007   .0086   428
30   .0007  .0002  .0012  199  .0026  .002   .0032   339
50   .0005  .0001  .0009  189  .0005  .0002  .0008   309
70   .0004  .0001  .0007  183  .001   .0006  .0014   297
90   .0001  .      .      178  .0008  .0005  .0011   285
110  .0003  .0001  .0005  175  .0002  .0001  .0003   276
130  .0003  .0001  .0005  168  .0002  .0001  .0003   271
150  .0003  .0001  .0005  162  .0002  .0001  .0003   264
170  .0005  .0001  .0009   93  .001   .0005  .0015   148
190  .0     .0     .0      13  .003   .0     .006     19 
200  .      .      .      .    .      .      .       . 
  ;
  run;

data hazard_Group;
  set hazard;
  label value='Hazard Rate';
  keep Day Drug Value Risk High Low;
  Drug='Drug A'; Value=a; Risk=Arisk; High=Ahigh; Low=Alow; output;
  Drug='Drug B'; Value=b; Risk=Brisk; High=Bhigh; Low=Blow; output;
  run;

ods graphics / reset width=5in height=3in imagename="5R_HazardFunctionGroup_SG";
title 'Hazard Function for Adverse Events of Special Interest';
proc sgplot data=hazard_group;
  step x=day y=Value / group=drug yerrorupper=High yerrorlower=Low 
                 justify=center lineattrs=( thickness=2) 
                 errorbarattrs=(pattern=solid thickness=2) name='a';
  xaxistable risk / class=drug colorgroup=drug titleattrs=(size=8) 
        title='Average number of subjects at risk during interval';
  keylegend / title='' location=inside position=topright across=1 linelength=20;
  xaxis values=(0 to 200 by 20); 
run;

title;