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