BookmarkSubscribeRSS Feed

[SAS 프로그래밍 고수 백승민] [GRAPH] 상자수염도(박스플롯 Boxplot) 겹쳐그리기(Overlay)

Started ‎06-11-2020 by
Modified ‎06-11-2020 by
Views 283

* 그래프는 사용을 안해서 자세한 설명을 드리기는 어렵고,
  도움말을 참고하시기를 바랍니다.
  버젼별로 그래프쪽이 많이 변화가 있어서 버젼별로도 많은 차이가 있을듯 합니다.
  V9.3에는 더 좋은 기능이 있는지 모르겠네요;

 

* 상세문서 : http://cafe.daum.net/statsas/B3s/377

 

 

Don’t Dither About Your Data, Let SAS/GRAPH Trending Box Plots Drive Decision Making
Tips and Tricks for Clinical Graphs using ODS Graphics;


data LFT;
input A B Test $;
cards;
1.05198 0.97755 ALAT
0.20475 0.20589 ALKPH
0.12868 0.10760 BILTOT
1.00211 1.19132 ALAT
1.50211 2.59132 ALAT
1.12868 1.10760 BILTOT
1.20475 1.20589 ALKPH
0.78177 1.59554 ASAT
0.18177 2.59554 ASAT
0.98177 3.59554 ASAT
0.58177 3.69554 ASAT
0.77177 9.59554 ASAT
0.28177 2.69554 ASAT
0.92177 3.69554 ASAT
0.52177 3.79554 ASAT
0.78177 9.69554 ASAT
;

 

/* V9.2 proc sgrender */
proc template;
     define statgraph Max_LFT_By_Trt_2;
     begingraph;
     entrytitle 'Distribution of Maximum Liver Function Test Values by Treatment';
     layout overlay / yaxisopts=(linearopts=(viewmin=0 viewmax=4)
            label='Maximum (/ULN)')
            xaxisopts=(display=(line ticks tickvalues)) cycleattrs=true;
     boxplot x=Test y=A / discreteoffset=-0.2 boxwidth=.2
             name='a' legendlabel='Drug A (N=209)';
     boxplot x=Test y=B / discreteoffset= 0.2 boxwidth=.2
             name='b' legendlabel='Drug B (N=405)';
     referenceline y=1 / lineattrs=(pattern=dot);
     discretelegend 'a' 'b' / location=inside valign=top halign=right across=1;
     endlayout;
     entryfootnote halign=left "For ALAT, ASAT and ALKPH, the Clinical ...;";
     entryfootnote halign=left "For BILTOT, the CCL is 1.5 ULN: where ULN ...";
     endgraph;
     end;
run;


ods graphics / reset border=off width=5in height=3in imagename="Max_LFT_by_TRT_2";
proc sgrender data=LFT template=Max_LFT_By_Trt_2; run;
quit;

 

/* V9.1.3 proc gplot */
symbol1 interpol=boxt10
        mode=exclude
        value=none
        co=green
        cv=black
        height=.6
        bwidth=15
        width=1;
 

symbol2 ci=blue  interpol=boxt10
        value=dot
        co=red
        cv=red
        height=.6
        bwidth=15
        width=1;

 

/* Define X-axis */
axis1 split='\' label=none
      length=100;
/* Define Y-axis */
axis2 label=(h=1.5 '(%)')
      order=(0 to 4);

/* Define Y-axis */
axis3 label=(h=1.5 '(%)')
      order=(0 to 4);

 

proc gplot data=LFT;
     plot a*test/ overlay haxis=axis1
                          vaxis=axis3;
     plot2 b*test/overlay vaxis=axis2;
run;

Version history
Last update:
‎06-11-2020 05:32 AM
Updated by:
Contributors

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Article Labels
Article Tags