SAS Programming

DATA Step, Macro, Functions and more
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 9912 views
  • 1 like
  • 2 in conversation