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

I need to change the font used in the body of a plot created by PROC SGPLOT.  Documentation says to use LABELATTRS tor the axis labels, which is where I will start.  Maybe I am putting it in the wrong place.  Any ideas?  This one is a box plot.  I will also have to do this on a line plot.  

 

Thank you...

 

 

          proc sgplot data=ft2 nowall;
               vbox change / extreme category = treatment  clusterwidth = 0.5  ;
               xaxis display = (noline nolabel noticks) discreteorder = data labelattrs=(family=courier size=8);
               yaxis values = (-20 to 8 by 1);
               run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Where do you want to change font, exactly?

Either use code with a SAS supplied data set or provide example data.

 

You need to provide the name of the font pretty much as it appears in the Windows Font folder such as:

proc sgplot data=sashelp.class;
   vbox height /category=sex ;
   xaxis labelattrs=(family="Courier New Regular" size=15pt color=red);
run;

Note the name in quotes.

This only changes the axis label value of "Sex".  However your code is specifically excluding displaying the label (the display= options) so the Labelattrs has nothing to apply the font to.

View solution in original post

2 REPLIES 2
ballardw
Super User

Where do you want to change font, exactly?

Either use code with a SAS supplied data set or provide example data.

 

You need to provide the name of the font pretty much as it appears in the Windows Font folder such as:

proc sgplot data=sashelp.class;
   vbox height /category=sex ;
   xaxis labelattrs=(family="Courier New Regular" size=15pt color=red);
run;

Note the name in quotes.

This only changes the axis label value of "Sex".  However your code is specifically excluding displaying the label (the display= options) so the Labelattrs has nothing to apply the font to.

davehalltwp
Quartz | Level 8
Thank you BallardW. Using the proper font name and enclosing it in quotes did the trick for axis labels (I also had to brush up on font names in general). And the VALUEATTRS option worked in a similar to adjust the font of the label of each data point on the box plots.

Thanks much...

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 2717 views
  • 3 likes
  • 2 in conversation