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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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