BookmarkSubscribeRSS Feed
den
Calcite | Level 5 den
Calcite | Level 5

Hi all,

I have created a panel plot using SGPANEL.  I would like to change the fonts within the plot to Courier/Courier New.  I have tried creating a new style using proc template (see code below) and ods graphics but with no luck.  Any advice on how to change the fonts and save the output to a pdf file would be much appreciated.

proc template;

  define style myfont;

  parent=styles.default;

   class GraphFonts /

         'GraphDataFont' = ("Courier_New",10pt)

         'GraphUnicodeFont' = ("Courier_New",10pt)

         'GraphValueFont' = ("Courier_New",10pt)

         'GraphLabelFont' = ("Courier_New",10pt)

         'GraphFootnoteFont' = ("Courier_New",10pt)

         'GraphTitleFont' = ("Courier_New",10pt)

         'GraphAnnoFont' = ("Courier_New",10pt);

end;

run;

ods listing style=myfont;

ODS PDF FILE='C:\Projects\SummaryFigure.PDF';

ods graphics on;

10 REPLIES 10
Jay54
Meteorite | Level 14

Use "Courier New"

den
Calcite | Level 5 den
Calcite | Level 5

Thanks for your reply.

I've tried using both Courier and Courier New previously and neither work.

Jay54
Meteorite | Level 14

Seems to work for me.  I am using SAS 9.2 (TS2M3).  Here is the SGPLOT image.  Also works for SGPANEL.

Courier.png

Jay54
Meteorite | Level 14

Here is the full program - SAS 9.2 (TS2M3):

proc template;

  define style myfont;

  parent=styles.listing;

   class GraphFonts /

         'GraphDataFont' = ("Courier New",10pt)

         'GraphUnicodeFont' = ("Courier New",10pt)

         'GraphValueFont' = ("Courier New",10pt)

         'GraphLabelFont' = ("Courier New",10pt)

         'GraphFootnoteFont' = ("Courier New",10pt)

         'GraphTitleFont' = ("Courier New",10pt)

         'GraphAnnoFont' = ("Courier New",10pt);

end;

run;

ods listing style=myfont;

ODS PDF FILE='C:\SummaryFigure.PDF' style=myfont;

ods graphics on / width=4in height=3in imagename='Courier';

title "Mileage by Type";

proc sgplot data=sashelp.cars;

  vbar type / response=mpg_city stat=mean nostatlabel;

  run;

ods pdf close;

ods graphics on / width=4in height=3in;

title "Mileage by Type";

proc sgpanel data=sashelp.cars;

  panelby origin;

  vbar type / response=mpg_city stat=mean nostatlabel;

  run;

art297
Opal | Level 21

Does the following provide what you need?: http://support.sas.com/techsup/technote/ts659/ts659.html

den
Calcite | Level 5 den
Calcite | Level 5

Thanks for your reply.

I've had a look at the link you provided.  I've tried these methods previously but to no avail.

DanH_sas
SAS Super FREQ

I think the problem is that you've set your style on the LISTING destination, but you did not set it on the PDF destination. Styles must be set on each open destination, unless you want the default for that destination.

Hope this helps!

Dan

den
Calcite | Level 5 den
Calcite | Level 5

Thanks for your reply.

I've also tried specifying the style in the ods pdf statement previously, but this results in creating a grey background for my graphic and not altering the font at all.

DanH_sas
SAS Super FREQ

You needed a combination of my answer and Sanjay's answer. You need to remove the underscore from "Courier_New" and make it "Courier New". I also suggest you use STYLES.LISTING instead of STYLES.DEFAULT so you will not get the gray background. Then, just set your new style on the PDf destination, and you should be all set.

Dan

den
Calcite | Level 5 den
Calcite | Level 5

I tried the combination of your and Sanjay's answers as you suggested and it worked well.  Many thanks to both you and Sanjay for your advise.

Den

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
  • 10 replies
  • 3861 views
  • 0 likes
  • 4 in conversation