FOCUS AREAS

Graphics

cluster groups with an AXISTABLE statement
Base SAS: Graph Template Language

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

data lipid;
  label a_med="Drug A" b_med="Drug B" c_med="Drug C" p_med="Placebo";
  format a_med b_med c_med p_med 4.2;
  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;

data lipid_group;
  length Drug $8;
  keep Day Drug Median Lcl Ucl;
  format Median Lcl Ucl 4.2;
  set lipid;
  Drug='Drug A'; Median=a_med; Lcl=a_lcl; Ucl=a_ucl; output;
  Drug='Drug B'; Median=b_med; Lcl=b_lcl; Ucl=b_ucl; output;
  Drug='Placebo'; Median=p_med; Lcl=p_lcl; Ucl=p_ucl; output;
  run;

proc template;
  define style styles.blueBG;
    parent = Styles.listing;
    style color_list from color_list
      "Abstract colors used in graph styles" /
        'bgA'   = cxe0e7ef;
  end;
run;

/*--Create template for graph--*/
proc template;
  define statgraph lipid_discrete_outer_stat_color;
    begingraph;
      entrytitle 'Median of Lipid Profile by Treatment and Visit';
      entryfootnote halign=left 'This graph uses cluster groups with the new AXISTABLE statement';
      layout lattice / rows=2 rowweights=preferred  columndatarange=union;
        layout overlay / yaxisopts=(griddisplay=on label='Median with 95% CL') 
            xaxisopts=(display=(ticks tickvalues));
          scatterplot x=day y=median / group=drug groupdisplay=cluster clusterwidth=0.5 
            yerrorlower=lcl yerrorupper=ucl  
            markerattrs=(symbol=circlefilled) errorbarattrs=(thickness=2);
          seriesplot x=day y=median / group=drug groupdisplay=cluster clusterwidth=0.5 
            lineattrs=(pattern=solid thickness=2) name='s';
          discretelegend 's' / location=inside halign=right valign=top across=1;
        endlayout;
        layout overlay  / walldisplay=none xaxisopts=(display=none) yaxisopts=(display=none);
          axistable x=day value=median / class=drug display=(label) valueattrs=(size=graphdatatext:fontsize) 
            labelattrs=(size=graphdatatext:fontsize) colorgroup=drug;
        endlayout;
      endlayout;
    endgraph;
  end;
run;

ods _all_ close;
ods listing gpath=&gpath image_dpi=&dpi style=styles.blueBG;
ods graphics / reset width=6.93in height=3.15in
  attrpriority=color imagename='V94_Lipid_Profile_AxisTable';
proc sgrender data=lipid_group template=lipid_discrete_outer_stat_color;
run;