I have a very long text for the label for one of the xaxistable group and when I try to generate the graph with that text, that particular group do not show up. However when I shorten the text to something which can fit on one line then it appears fine.
I am not sure if it is possible give a very long text (which wraps over to multiple lines) for the label for the axistable group?
I am using SAS 9.4.
Below is the code that I am trying to use.
and format trtf is:
1 ='this is a very long text that can not fit on one line';
PROC SGPLOT data=atrisk;
styleattrs datacontrastcolors=(blue red);
step x=week y=_y / group=trt01pn_ lineattrs=(pattern=solid) name='s';
scatter x=week y=censor_ / markerattrs=(symbol=plus) GROUP=trt01pn_;
xaxistable risk / x=week class=trt01pn_ location=outside
colorgroup=trt01pn_ separator LABELATTRS=(size=*7.8*);;
keylegend 's' / location=inside position=bottomright down=*3*
yaxis min=*0.0* label = 'Probability of ventilation free survival';
xaxis values = (*0*,*13*,*26*,*39*,*52*,*65*,*78*,*91*,*104*,*117*,*130*,
*143*) label = 'Time (weeks)' offsetmax=*0.05*;
format trt01pn_ trtf.;
If I use simpler step plot with a SAS supplied data set, SASHELP.STOCKS, I can generate an xaxistable with longer text than that where the label displays. This shows the xaxistable label but the LEGEND is not displayed. The xaxistable label wraps to three lines in my default graph area. How many formatted values of your variable do you have? Perhaps the issue is that for the number of rows it is attempting to display there is no room to wrap the label text. You are using options I do not have with SAS 9.4M4, such as separator, so I have no idea what impact those may have on this issue. A smaller size for LABELATTRS does allow the legend to appear but I still have the axis row label wrap to three lines and smaller values that wrap to 2 lines may or may not have the legend appear.
proc format library=work; value $trtf 'IBM'= "This is a very very very very really really really long test label" ; run; proc sgplot data=sashelp.stocks (where=(year(date)=2001 )); step x=date y=close/ group=stock; xaxistable low/x=date class=stock; format stock $trtf.;
format low dollar4.0 ; run;
How long is long?
What are the dimensions of your display?
If you are attempting to write 200+ characters and only have 2 inches there could be an issue with default font sizes for instance.
Code would really help answer questions or point up alternatives.
Perhaps you need to investigate labelattrs to change font size?
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.