Data visualization with SAS programming

Proc SGPLOT xaxistable

Reply
New Contributor
Posts: 3

Proc SGPLOT xaxistable

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!

Super User
Super User
Posts: 7,714

Re: Proc SGPLOT xaxistable

SAS Super FREQ
Posts: 1,139

Re: Proc SGPLOT xaxistable

[ Edited ]

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

New Contributor
Posts: 3

Re: Proc SGPLOT xaxistable

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

Super User
Super User
Posts: 7,714

Re: Proc SGPLOT xaxistable

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

New Contributor
Posts: 3

Re: Proc SGPLOT xaxistable

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!

SAS Super FREQ
Posts: 1,139

Re: Proc SGPLOT xaxistable

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.

Ask a Question
Discussion stats
  • 6 replies
  • 296 views
  • 2 likes
  • 3 in conversation