BookmarkSubscribeRSS Feed
xguo2
Calcite | Level 5

Does anyone know how to do left or right justified values in the table underneath plot with using Proc SGPLOT xaxistable. Currently the default is center-justified. Many thanks!

6 REPLIES 6
Jay54
Meteorite | Level 14

ValuesHAlign and ValuesJustify are available for the YAxisTable.  These are NOT available for XAxisTable.  Please see documentation.

xguo2
Calcite | Level 5

I was searching for the manual prior to posting, and do not think ValuesHAlign and ValuesJustify work for xaxistable. Please confirm if the counterpart statement available for xaxistable. Thanks

RW9
Diamond | Level 26 RW9
Diamond | Level 26

You need to try it, I have nothing here of your project to try this out on.

xguo2
Calcite | Level 5

Hi I forgot to mention that I tried both statement which were listed for YAXISTABLE, and got error message like below:

ERROR 22-322: Syntax error, expecting one of the following: ;, ATTRID, CLASS, CLASSDISPLAY, CLASSORDER, COLORGROUP, DROPONMISSING, INDENT, INDENTWEIGHT, LABEL, LABELATTRS,
              LABELPOS, LOCATION, NAME, NOLABEL, NOMISSINGCHAR, NOMISSINGCLASS, NOSTATLABEL, PAD, POSITION, SEPARATOR, STAT, STATLABEL, TEXTGROUP, TEXTGROUPID, TITLE,
              TITLEATTRS, VALUEATTRS, X, X2AXIS.
ERROR 76-322: Syntax error, statement will be ignored.

 

The syntax I used is like this:

proc sgplot data=su;
 step x=time y=survival /group=stratum name='survival' lineattrs=(thickness=2) ;

 scatter x=time y=surv /GROUP=stratum  markerattrs=(symbol=circlefilled size=2);
xaxistable atrisk /class=stratum x=tatrisk colorgroup=stratum labelpos=left  ValuesHAlign=right
                   VALUEATTRS=(size=9 weight=bold)  LABELATTRS=(size=9 weight=bold);

keylegend 'survival' /location=inside position=bottomleft across=1;

xaxis min=0 max=24 offsetmax=0.05 values=(0 to 24 by 6) valueshint label='Time'
                                 labelattrs=( size=9pt weight=bold) valueattrs=( size=9pt weight=bold);
yaxis offsetmin=0.02 min=0 offsetmax=0.02 max=1.0
                     labelattrs=( size=9pt weight=bold ) valueattrs=( size=9pt weight=bold);
run;

 

I also tried to convert variable 'tatrisk' to character type to see the alignment can be set, however xaxistable function only accept numeric variable.

 

Any other suggestions- Thank you!

Jay54
Meteorite | Level 14

In the code you have attached, you are using XAXISTABLE, which does NOT support ValuesHAlign.  Please attach a full working program (with some dummy date) so we can see what is going on.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 6 replies
  • 3042 views
  • 2 likes
  • 3 in conversation