Mean Median legend for a boxplot using PROC TEMPLATE in SAS

57 views Asked by At

Display a legend for a boxplot where the symbol blue diamond represents the mean, red straight line represents the median using PROC TEMPLATE in SAS.

proc template;
    define statgraph test1;
      dynamic _mean _assay _calconc _assay2 _mean2 _median;
        begingraph;
           title 'Box Plot';
                   layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;
              layout overlay / xaxisopts=( type=discrete labelattrs=(size=11 ) tickvalueattrs=(size=10 ) 
                        discreteopts=( tickvaluefitpolicy=splitrotate)) 
                        yaxisopts=( type=log label=('Log Concentration') 
                        labelattrs=GraphLabelText(size=11 ) 
                        tickvalueattrs=GraphDataText( size=10 ) 
                        logopts=( base=10 viewmin=1.0 viewmax=10000.0 
                        tickvaluepriority=TRUE tickvaluelist=(1.0 10.0 100.0 1000.0 10000.0)));
                 boxplot x=_ASSAY y=_MEAN / name='box' displaystats=(n mean median min max)
                                                          datalabelattrs=GraphLabelText(size=12 ) 
                                groupdisplay=Overlay
                                medianattrs=(color=CXFF0000 thickness=3) 
                                meanattrs=GraphDataDefault(color=CX0000FF symbol=DIAMOND size=10 weight=bold);  
                
                 innermargin / align=bottom; 
                 endinnermargin;
           endlayout;
           endlayout;
        endgraph;
     end;
    run;
    proc sgrender data=final template=test1;
        dynamic _mean="MEAN" _assay="ASSAY" _calconc="CALCONC" _assay2="ASSAY" 
                _mean2="MEAN" _median="MEDIAN";
        format Mean comma10.2;
    run;


0

There are 0 answers