FOCUS AREAS

Graphics

Depression After Treatment by Visit and Treatment
Base SAS: ODS Graphics Procedure: SGPANEL

%let graphs='.';

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

/*--Generate data--*/
data DepressionAfterTrt;
  length Trt $8;
  label Trt='Treatment' Score='Change in Depression Score since Baseline';
  keep Trt Visit Score Phase;
  retain min 100 max -100;
  do Trt='Drug', 'Placebo';
     do Visit=1 to 9;
        if visit le 3 then Phase='Phase 1';
        else if visit le 6 then Phase='Phase 2';
        else Phase='Phase 3';
        do count=1 to 10;
           Score=0.5*rannor(2);
           min=min(min, score);
           max=max(max, score);
           output;
        end;
     end;
  end;
  call symput ("min", min);
  call symput ("range", max-min);
run;

/*--Normalize the data--*/
data depression;
  set DepressionAfterTrt;
  score=5*((score-&min) / &range -0.5);
run;
    
/*--Render graph--*/
ods listing style=htmlblue gpath=&graphs image_dpi=&dpi;
ods graphics / reset width=&w height=&h imagename="DepressionAfterTrt_V93";
title 'Depression After Treatment by Visit and Treatment';
proc sgpanel data=depression nocycleattrs;
  panelby phase / layout=columnlattice onepanel novarname uniscale=row spacing=2;
  vbox score / category=visit group=trt clusterwidth=0.75 boxwidth=0.9  
    transparency=0.3 lineattrs=(color=black) whiskerattrs=(color=black);
  colaxis display=(nolabel);
  rowaxis grid;
run;