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


%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? 

1 ACCEPTED SOLUTION

Accepted Solutions
RichardDeVen
Barite | Level 11

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 ?

View solution in original post

2 REPLIES 2
RichardDeVen
Barite | Level 11

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 ?

lillymaginta1
Obsidian | Level 7

perfect! thank you very much 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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