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

Hi everyone,

 

I am writing to seek assistance with centering the values of "HR (95% CI)" in a PROC SGPLOT procedure.

Currently, in my code, the values of "HR (95% CI)" (Var name=HR2)are aligned to the left, and I would like to center them instead. However, I am unsure how to achieve this.

YYK273_0-1715384682871.png

 

 

Below is my SAS code:

proc sgplot data=forest_subgroup_2 nowall noborder nocycleattrs dattrmap=attrmap noautolegend;
  format text $txt.;
  styleattrs axisextent=data;
  refline ref2 / lineattrs=(thickness=13 color=cxf0f0f7);
  highlow y=obsid low=CIL high=CIU; 
  scatter y=obsid x=hr / markerattrs=(symbol=squarefilled);
  scatter y=obsid x=hr / markerattrs=(size=0) x2axis;
  refline 1 / 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 HR2  pvalue/ location=inside position=right pad=(right=15px) 
             labelattrs=(size=7) valueattrs=(size=7) ;
  yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.0;
  xaxis display=(nolabel) /* TYPE=LOG TYPE=LOG LOGSTYLE=LOGEXPAND LOGBASE=10 */ values=(0.0 0.5 1.0 1.5 2.0 2.5 3.0 );
  x2axis label='Hazard Ratio' display=(noline noticks novalues) labelattrs=(size=8);
run;

Could you please advise me on how I can modify the yaxistable HR2 code to center align the values of "HR (95% CI)"?

Thank you very much for your attention to this matter. I look forward to your guidance.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Try this option:
yaxistable HR2 pvalue / VALUEJUSTIFY=center ;

View solution in original post

1 REPLY 1
Ksharp
Super User
Try this option:
yaxistable HR2 pvalue / VALUEJUSTIFY=center ;

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
  • 1 reply
  • 1362 views
  • 2 likes
  • 2 in conversation