BookmarkSubscribeRSS Feed
Chiru27
Calcite | Level 5

Hi,

 

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.

 

Thanks!
Chirag.

7 REPLIES 7
Jagadishkatam
Amethyst | Level 16
Could you please send us the code you are using to generate the graph. could you please also check your code to see if you are using the XAXIS option FITPOLICY, it controls how text for tickmarks displays.
Thanks,
Jag
Chiru27
Calcite | Level 5
Thanks for the response. I don't think fitpolicy is an option for xaxistable?
Jagadishkatam
Amethyst | Level 16
if you could send the code you have it will help me to see where we could update the code.

since you have not used the FITPOLICY, I would suggest you to try using it as shown in the example below,

proc sgplot data=example
noautolegend noborder;
vbar name / response=height
dataskin=pressed nostatlabel
baselineattrs=(thickness=0)
fillattrs=graphdata3
filltype=gradient;
xaxis display=(nolabel noline noticks)
fitpolicy=SPLITALWAYS SPLITCHAR=" ";
yaxis display=(noline);
run;
Thanks,
Jag
Chiru27
Calcite | Level 5
HI,

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*
valueattrs=(size=*8*);

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.;

RUN;
Thanks!
Chirag.
ballardw
Super User

@Chiru27 wrote:
HI,

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*
valueattrs=(size=*8*);

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.;

RUN;
Thanks!
Chirag.

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;
Chiru27
Calcite | Level 5
Thanks Ballardw. Yes, trt01pn_ had 2 values and both had very long text
that wrapped over to multiple lines. Did you try multiple rows? did it
work?
ballardw
Super User

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?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2974 views
  • 0 likes
  • 3 in conversation