BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sandrube
Fluorite | Level 6

Hello friends,

 

I am in the process of creating forest plot with PROC SGPLOT using the below code. However, the first line is only half visible. Could you please help me fix it.

 

Thank you very much for your help!

 

Rube

 


data forest;
length subgroup $ 25;
length orci $ 15;
input subgroup $ OR LCI RCI p_value orci $ indentwt level obsid text $ xl $ yl $ ref2 $ id F15 $ F16 $ F17 $ F18 $;
datalines;
Non-Hodgkin_lymphoma '' '' '' '' . 0 2 1 . . . . 1 . . . .
In-hospital_death 4.04 2.11 7.76 0.001 4.06(2.11-7.76) 1 1 2 . . . . 2 . . . .
Prolonged_los 2.32 1.56 3.46 0.001 2.32(1.56-3.46) 1 1 3 . . . . 2 . . . .
Hodgkin_lymphoma '' '' '' '' . 0 2 4 . . . . 1 . . . .
In-hospital_death 1.82 1.43 2.76 0.001 1.82(1.43-2.76) 1 1 5 . . . . 2 . . . .
Prolonged_los 1.55 1.34 2.84 0.001 1.55(1.34-2.84) 1 1 6 . . . . 2 . . . .
Multiple_myeloma '' '' '' '' . 0 2 7 . . . . 1 . . . .
In-hospital_death 4.28 2.16 8.48 0.001 4.28(2.16-8.48) 1 1 8 . . . . 2 . . . .
Prolonged_los 3 2 4.51 0.001 3.00(2.00-4.51) 1 1 9 . . . . 2 . . . .
;
run;

 

data forest_1;
set forest;
label orci='aOR (95% CI)';
label subgroup='Variables';
RUN;

 

proc format;
value $txt
"T" = "More Adverse Events (*ESC*){Unicode '2192'x}"
"P" = "(*ESC*){Unicode '2190'x} Fewer Adverse Events";
run;

 

/*--Attribute maps for Subgroup Test attributes--*/
data attrmap;
length textweight $10;
id='text'; value='1'; textcolor='Black'; textsize=7; textweight='bold'; output;
id='text'; value='2'; textcolor='Black'; textsize=5; textweight='normal'; output;
run;

 

%let gpath='C:\Users\15129\Desktop\New folder';
%let dpi=200;
ods html close;
ods _all_ close;
ods listing gpath=&gpath image_dpi=&dpi;

 

/*--Forest Plot--*/
options missing=' ';
ods listing style=HTMLBLUE;
/*title j=c h=12pt "Top 10 primary diagnosis associated with cancer hospitalizations";*/
/*title2 j=c h=10pt 'Odds Ratio and 95% CI';*/
ods graphics on / reset width=5in height=3in imagefmt=tiff imagename='Forest_plot';
proc sgplot data=forest_1 nowall nocycleattrs dattrmap=attrmap noautolegend;
format text $txt.;

 

styleattrs axisextent=data;
refline ref2 / lineattrs=(thickness=25 color=cxf0f0f7);
highlow y=obsid low=lci high=rci / type=line lineattrs=(color=red);
scatter y=obsid x=or / markerattrs=(color=green size=10 symbol=squarefilled);
scatter y=obsid x=or / markerattrs=(size=0) x2axis;
refline 1 10 / axis=x;
/* text x=xl y=obsid text=text / position=bottom contributeoffsets=none strip;*/
yaxistable subgroup / location=inside position=left textgroup=id labelattrs=(size=7) textgroupid=text indentweight=indentWt;
yaxistable orci / location=inside position=left labelattrs=(size=7) valueattrs=(size=7);
yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.0;
/* xaxis display=(nolabel) values=(0.0 0.5 1.0 5.0 10.0 15.0) ;*/
xaxis offsetmin=0 offsetmax=0.03 min=0 max=10 minor display=(nolabel);
x2axis label=' ' display=(noline noticks novalues) labelattrs=(size=12);
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

You have set the OFFSETMIN= option to 0. Either delete the option or set it to a larger value such as

yaxis reverse ... offsetmin=0.1;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

You have set the OFFSETMIN= option to 0. Either delete the option or set it to a larger value such as

yaxis reverse ... offsetmin=0.1;

sandrube
Fluorite | Level 6

Thank you very much! Solved the problem!!!

 

Rube

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 497 views
  • 1 like
  • 2 in conversation