FOCUS AREAS

Graphics

Median of Lipid Profile by Visit and Treatment
Base SAS: ODS Graphics Procedure: SGPLOT

%let graphs='.';

%let dpi=100;
%let w=8in;
%let h=4.5in;

/*--Lipid Graph--*/
Data lipid;
label a_med="Drug A" b_med="Drug B" c_med="Drug C" p_med="Placebo";
input Day $ 1-10 a_med a_lcl a_ucl b_med b_lcl b_ucl c_med c_lcl c_ucl p_med p_lcl p_ucl;
cards;
Baseline   5.21 5.04 5.52 5.17 4.94 5.47 5.24 4.97 5.33 5.08 4.81 5.35
Visit 1    4.90 4.60 5.79 6.65 4.81 7.51 5.74 5.51 6.78 4.49 4.03 4.94
Visit 2    5.30 5.04 6.44 4.77 4.15 7.84 4.40 3.34 6.13 4.94 4.81 5.11
Visit 3    6.05 4.91 6.84 5.15 3.91 6.83 5.81 5.17 6.65 5.09 4.29 5.90
Visit 4    5.20 5.07 5.39 5.28 5.15 5.38 5.35 5.22 5.52 5.10 4.94 5.23
End Point  5.24 4.97 5.48 5.15 5.09 5.42 5.34 5.15 5.53 5.04 4.94 5.22
;
run;

/*--Create lipid data by group--*/
data lipid_grp;
  set lipid;
  length trt $8;
  keep day trt median lcl ucl;
  Trt='Drug A'; Median=a_med; LCL=a_lcl; UCL=a_ucl; output;
  Trt='Drug B'; Median=b_med; LCL=b_lcl; UCL=b_ucl; output;
  Trt='Drug C'; Median=c_med; LCL=c_lcl; UCL=c_ucl; output;
  Trt='Placebo'; Median=p_med; LCL=p_lcl; UCL=p_ucl; output;
  run;

/*--Render the Graph--*/
ods listing style=htmlblue gpath=&graphs image_dpi=&dpi;
ods graphics / reset width=&w height=&h imagename="Median_of_Lipid_Profile_Group_V93";
title 'Median of Lipid Profile by Visit and Treatment';
proc sgplot data=lipid_grp;
  scatter x=day y=median / yerrorlower=lcl yerrorupper=ucl group=trt  
          groupdisplay=cluster clusterwidth=0.5 markerattrs=(symbol=circlefilled size=11)
          errorbarattrs=(thickness=2);
  series  x=day y=median / group=trt  groupdisplay=cluster clusterwidth=0.5 
          lineattrs=(thickness=2) name='s';
  yaxis label='Median with 95% CL' grid;
  xaxis display=(nolabel);
  keylegend 's' / title='Treatment' location=inside position=topright across=1;
  run;