BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
xxformat_com
Barite | Level 11

Hi,

 

When the axis label is displayed on more than one line, it is displayed properly unless the xaxistable statement is used.

 

Is there an option to avoid this behavior?

 

ods graphics / height=200px width=400px;

proc sgplot data=sashelp.class;
    vbarbasic sex / response=height stat=mean;
    yaxis label='This is a long label on several lines to illustrate the problem';
    
   *xaxistable sex;
   *xaxistable sex / label='this is a long label' ;
run;     
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

One thing to consider when discussing sizes of graphs: PX is not standard. You PX may be larger or smaller than mine due to monitor resolution. So setting sizes in terms of PX is almost always questionable.

 

Second, you have not actually stated what you want as a solution. Is it to display a long label and not have an Axistable label? Display both?

 

You may be able to control where the Axis label splits by inserting characters such as:

proc sgplot data=sashelp.class ;
    vbarbasic sex / response=height stat=mean;
    yaxis label="This is a long label(*ESC*){unicode '000a'x} on several lines to (*ESC*){unicode '000a'x}illustrate the problem"
   ;
    
   xaxistable sex/;
   /*xaxistable sex / label='this is a long label' ;*/
run;  

The (*ESC*) is equivalent to ESCAPECHAR for inserting style elements in the places where the define Escapechar may not be recognized.

View solution in original post

3 REPLIES 3
ballardw
Super User

One thing to consider when discussing sizes of graphs: PX is not standard. You PX may be larger or smaller than mine due to monitor resolution. So setting sizes in terms of PX is almost always questionable.

 

Second, you have not actually stated what you want as a solution. Is it to display a long label and not have an Axistable label? Display both?

 

You may be able to control where the Axis label splits by inserting characters such as:

proc sgplot data=sashelp.class ;
    vbarbasic sex / response=height stat=mean;
    yaxis label="This is a long label(*ESC*){unicode '000a'x} on several lines to (*ESC*){unicode '000a'x}illustrate the problem"
   ;
    
   xaxistable sex/;
   /*xaxistable sex / label='this is a long label' ;*/
run;  

The (*ESC*) is equivalent to ESCAPECHAR for inserting style elements in the places where the define Escapechar may not be recognized.

xxformat_com
Barite | Level 11

One thing to consider when discussing sizes of graphs: PX is not standard. You PX may be larger or smaller than mine due to monitor resolution. So setting sizes in terms of PX is almost always questionable.

 

Good to know. What unit would you recommand? Right now, the default unit in SAS is px.

proc registry list startat="ods\ods graphics";
run;

 

Second, you have not actually stated what you want as a solution. Is it to display a long label and not have an Axistable label? Display both?

Well, from my tests, the long axis label issue is independant of the axis label.

 

I just want to be able to keep the full axis label even if axistable is used.

 

ballardw
Super User

Units would be which make sense for your work group or organization. SAS graphic procedures will accept IN CM MM and decimal values with them so are human readable and understandable though some don't do well with conversions between English and Metric units. You can also use PT, 72 dots per inch but that gets cumbersome for most uses, PCT percentage of display area which can be a good choice when using a display that will scale things.

 

That height/width  480 x 640 pixels happens to be an ancient VGA graphics standard that was the maximum many monitors would even attempt to display about 30 years ago and is sort of a least common denominator for displays.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 455 views
  • 3 likes
  • 2 in conversation