Data visualization with SAS programming

How to wrap yaxis title when using an xaxistable in proc sgplot

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 79
Accepted Solution

How to wrap yaxis title when using an xaxistable in proc sgplot

Hi - Is there a way to wrap a y-axis title when using xaxistable (to get around at present I am using labelpos=top, but would prefer it at the default for consistency with other charts).

 

Eg. of problem the following code : 

 

proc sgplot data=sashelp.cars(where=(make = 'Acura'));
vbar model/response=invoice;
yaxis label= "This no longer wraps, how can I get it to wrap?";
xaxistable invoice /label="a" valueattrs= (color=liggr) labelattrs=(size=8pt);
run;

 

returns the following:

yaxistruncate.png

 

 


Accepted Solutions
Solution
‎09-04-2017 03:04 AM
Regular Contributor
Posts: 226

Re: How to wrap yaxis title when using an xaxistable in proc sgplot


All Replies
Frequent Contributor
Posts: 79

How to wrap yaxis title when using an xaxistable in proc sgplot

[ Edited ]

Hi - Is there a way to wrap a y-axis title when using xaxistable (to get around at present I am using labelpos=top, but would prefer it at the default for consistency with other charts).

 

Eg. of problem the following code : 

 

proc sgplot data=sashelp.cars(where=(make = 'Acura'));
vbar model/response=invoice;
yaxis label= "This no longer wraps, how can I get it to wrap?";
xaxistable invoice /label="a" valueattrs= (color=liggr) labelattrs=(size=8pt);
run;

 

returns the following:

 

 

 

yaxistruncate.png

 

 

 

Solution
‎09-04-2017 03:04 AM
Regular Contributor
Posts: 226

Re: How to wrap yaxis title when using an xaxistable in proc sgplot

How about this? GENERATING MULTILINE AXIS LABELS IN SAS PROC SGPLOT | SAS CODE FRAGMENTS.

It will be the yaxis in your case.

HTH.

SAS Super FREQ
Posts: 1,139

Re: How to wrap yaxis title when using an xaxistable in proc sgplot

Another way, not mentioned in the linked article is to place the xaxistable inside the plot area.  Set LOCATION=INSIDE on the xAxisTable.

xaxistable invoice /label="a" valueattrs= (color=liggr) labelattrs=(size=8pt) location=inside;
Frequent Contributor
Posts: 79

Re: How to wrap yaxis title when using an xaxistable in proc sgplot

Thank-you - that also works.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 192 views
  • 4 likes
  • 3 in conversation