|
|
|
|
|
|
w*******e 发帖数: 666 | 1 在SAS的官网上找到个链接,有画forest plot的code。
想请教:
如果sohn 2002 snow 1999 和raine2003 下还分别有A B C 三个race,该怎么修改上面
的code呢?
我试了半天,连input data都一直报错。
或者哪位在哪里看到相似的例子,能否发我一份呢?
非常感谢!
得出的图如下:
http://support.sas.com/kb/35/773.html
code 如下:
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create sample data for forest plot. */
data test;
input yvar $ 1-10 lower_limit rate upper_limit;
datalines;
Sohn 2002 1.2 1.5 2.2
Raine 2003 2.2 2.5 3.0
Snow 1999 0.8 1.3 4.4
;
run;
/* Create an annotate data set to draw the lines. */
data anno;
length function style color $8;
retain xsys ysys '2' when 'a';
set test;
/* Draw the horizontal line from lower_limit to upper_limit */
function='move'; xsys='2'; ysys='2'; yc=yvar; x=lower_limit; color='black
'; output;
function='draw'; x=upper_limit; color='black'; size=1; output;
/* Draw the tick line for the lower_limit value */
function='move';xsys='2'; ysys='2';yc=yvar; x=lower_limit; color='black';
output;
function='draw';x=lower_limit; ysys='9'; y=+1; size=1; output;
function='draw';x=lower_limit; y=-2; size=1;output;
/* Draw the tick line for the upper_limit value */
function='move';xsys='2'; ysys='2'; yc=yvar; x=upper_limit; color='black'
; output;
function='draw';x=upper_limit; ysys='9'; y=+1; size=1; output;
function='draw';x=upper_limit; y=-2; size=1; output;
run;
title1 'Forest Plot with PROC GPLOT';
axis1 label=none
minor=none
offset=(5,5);
axis2 order=(0 to 4.5 by 0.5)
label=('Odds Ratio')
minor=none;
symbol1 interpol=none color=black value=dot height=1.5;
proc gplot data=test;
plot yvar*rate / annotate=anno
nolegend
vaxis=axis1
haxis=axis2
href = 1
lhref = 2;
run;
quit; |
|
|
|
|
|