%let gpath='.';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Add "Id" to identify subgroup headings from values--*/
data forest_subgroup;
input Id Comparison $3-28 Count Percent Mean Low High PCIGroup Group SampleSize;
indentWt=1;
ObsId=_n_;
datalines;
1 mm 1 . . . . . . .
1 hh 1 . . . . . . .
1 rr . . 1.40 1.18 2.12 . . .
1 rr . . . . . . . .
2 tt . . 1.99 1.42 2.88 . . .
2 yy . . 1.77 1.53 2.51 . . .
2 xx . . 1.72 1.60 2.09 . . .
;
run;
/*ods html;*/
/*proc print;run;*/
/*ods html close;*/
/*--Set indent weight, add insets and horizontal bands--*/
data forest_subgroup_2;
set forest_subgroup nobs=n end=last;
length text $25;
val=mod(_N_-1, 6);
if val eq 1 then ref=count;
/*--Separate Subgroup headers and obs into separate columns--*/
indentwt=1;
if id=1 then indentWt=0;
output;
if last then do;
call missing (Comparison, count, percent, mean, low, high,
pcigroup, group, countpct, indentwt, val, ref);
obsid=n+1;
xl=0.4; yl=n+1; text=' '; output;;
xl=1.7; yl=n+1; text=' '; output;
end;
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;
/*--Forest Plot--*/
options missing=' ';
ods listing style=htmlBlue;
ods graphics / reset width=4in height=3in imagename='Subgroup_Forest';
proc sgplot data=forest_subgroup_2 nowall noborder nocycleattrs dattrmap=attrmap noautolegend;
styleattrs axisextent=data;
highlow y=obsid low=low high=high;
scatter y=obsid x=mean / markerattrs=(symbol=squarefilled);
scatter y=obsid x=mean / markerattrs=(size=0) x2axis;
refline ref/ lineattrs=(thickness=4 color=cxf0f0f0);
refline 1/ axis=x;
text x=xl y=obsid text=text / position=bottom contributeoffsets=none strip;
yaxistable Comparison / location=inside position=left textgroup=id labelattrs=(size=8)
textgroupid=text indentweight=indentWt ;
yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.0;
xAXIS TYPE=LOG LOGSTYLE=LOGEXPAND LOGBASE=10;
xaxis display=(nolabel) values=( 0.5 1.0 1.5 2.0 2.5 3.0);
x2axis type=log label=' ' display=(noline noticks novalues) labelattrs=(size=8) ;
run;
run;
Hi Everyone, I am trying to remove the label of the y-axis "comparison" from the above code, any thought on how to do that?
Label the table variable with a hard space 'A0'x
label Comparison='A0'x;
You can also use the null character '00'x
label Comparison='00'x;
Moderators: This should be moved to Graphics Programming ?
Label the table variable with a hard space 'A0'x
label Comparison='A0'x;
You can also use the null character '00'x
label Comparison='00'x;
Moderators: This should be moved to Graphics Programming ?
perfect! thank you very much
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: