BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BobHope
Quartz | Level 8

I have a issue with sgplot. I have categorical y-axis with text values and numerical x axis. I would want to control the x-axis font size separately from the y-axis, since the x-axis font size is just fine, but my y axis values are so long that I would need to reduce the font size. So far I have found proc template the only way to even change the font sizes. However when I change the 'GraphvalueFont' value it affects both the x and y axis. The problem is that now the x-axis becomes unreadable. So is there any way to control those font sizes separately? Could I somehow initialize a new class for example GraphValueText2 or something? Or is the GTL and sgrender the way to go?

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Hi

Have you tried the LABELATTRS= and VALUEATTRS= option of the YAXIS statement?

See sample below:

data have;
  do y = "A", "B", "C", "D";
   
length y2 $ 64;
   
call missing(y2);
    do i = 1 to 10;
      y2 = catx(
" ", y2, repeat( y, ceil(ranuni(0) * 8 ))); 
   
end;
  
   
x = ceil( ranuni(0) * 50);
    output;
 
end;
run;

proc sgplot data=have;
  hbar y2 / response=x;
  yaxis
   
labelattrs=( size=5pt color=red )
   
valueattrs=( size=5pt color=red )
/*    fitpolicy=splitalways */
  ;
  xaxis
   
labelattrs=( size=12pt )
   
valueattrs=( size=12pt )
  ;

run;

View solution in original post

2 REPLIES 2
BrunoMueller
SAS Super FREQ

Hi

Have you tried the LABELATTRS= and VALUEATTRS= option of the YAXIS statement?

See sample below:

data have;
  do y = "A", "B", "C", "D";
   
length y2 $ 64;
   
call missing(y2);
    do i = 1 to 10;
      y2 = catx(
" ", y2, repeat( y, ceil(ranuni(0) * 8 ))); 
   
end;
  
   
x = ceil( ranuni(0) * 50);
    output;
 
end;
run;

proc sgplot data=have;
  hbar y2 / response=x;
  yaxis
   
labelattrs=( size=5pt color=red )
   
valueattrs=( size=5pt color=red )
/*    fitpolicy=splitalways */
  ;
  xaxis
   
labelattrs=( size=12pt )
   
valueattrs=( size=12pt )
  ;

run;
BobHope
Quartz | Level 8

Well this is embarrasing, but thanks a lot. I have never encountered with these options in the sas help, but now that I googled it I found them.

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
  • 2 replies
  • 9092 views
  • 1 like
  • 2 in conversation