ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KevinViel
Pyrite | Level 9

How does one change the font family and size in output, particularly in ODS destinations like PDF.

 

Creating a new style definition using the TEMPLATE procedure with inheritance would seem to be appropriate, but even when I use the STYLE= option in the ODS PDF statement, it did not seem to help.

 

proc template ;

  define style
            styles.fda
            ;

    parent = styles.pearl ;

     class fonts
        / "TitleFont"           = ( Arial   , 10pt )
          "TitleFont2"          = ( Arial   , 10pt )
          "StrongFont"          = ( Arial   , 10pt , bold )
          "EmphasisFont"        = ( Arial   ,  9pt , italic )
          "FixedEmphasisFont"   = ( Courier ,  9pt )
          "FixedStrongFont"     = ( Courier ,  9pt , bold )
          "FixedHeadingFont"    = ( Courier ,  9pt , bold )
          "BatchFixedFont"      = ( Courier ,  9pt )
          "FixedFont"           = ( Courier ,  9pt )
          "headingEmphasisFont" = ( Arial   ,  9pt , bold italic )
          "headingFont"         = ( Arial   ,  9pt , bold )
          "docFont"             = ( Arial   ,  9pt )
          ;

      style data from data
         / font = fonts( "docFont" )
           ;

  end ;

run ;

 I was able to change the individual attributes for the various location in the PRINT procedure.  What can one do if one wants to direct the output of a procedure like GLM or MIXED to PDF, but have the font be a certain family and size.  Currently, it appears to be Albany.

 

Thank you,

 

Kevin

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  REPLACE was deprecated in 9.2 and it was my understanding that if you use REPLACE now, in 9.2, 9.3 or 9.4 that it will behave the same way as STYLE or CLASS statements in PROC TEMPLATE. However, I was always advised to use the "official" name of the Arial font, which in PDF-land is "Arial Unicode MS" and also advised to always use the "official" name of the Courier font, which is "Courier New". As you can see from the screen shot below (I did change the original template so the changes were obvious), when I use those font names, the correct fonts are embedded and appear to be used.

 

  To make specific changes to PROC PRINT data cells or header cells or areas like the summary line, the OBSHEADER and the OBS numbers, you need to use STYLE(area)= overrides in the PROC PRINT syntax, as shown in the second example.

 

cynthia

 

undefined

View solution in original post

4 REPLIES 4
Reeza
Super User

Try Replace Fonts? 

 

This is is an example of one I use. 

 

https://gist.github.com/statgeek/9603140

 

 

 

 

Cynthia_sas
SAS Super FREQ

Hi:

  REPLACE was deprecated in 9.2 and it was my understanding that if you use REPLACE now, in 9.2, 9.3 or 9.4 that it will behave the same way as STYLE or CLASS statements in PROC TEMPLATE. However, I was always advised to use the "official" name of the Arial font, which in PDF-land is "Arial Unicode MS" and also advised to always use the "official" name of the Courier font, which is "Courier New". As you can see from the screen shot below (I did change the original template so the changes were obvious), when I use those font names, the correct fonts are embedded and appear to be used.

 

  To make specific changes to PROC PRINT data cells or header cells or areas like the summary line, the OBSHEADER and the OBS numbers, you need to use STYLE(area)= overrides in the PROC PRINT syntax, as shown in the second example.

 

cynthia

 

undefined

KevinViel
Pyrite | Level 9

Thanks to both Cynthia and Reeza for offering solutions.

 

Pearl inherits from Printer, which appears to go to "base" elements.  In Printer, ContentTitle  specifies font = fonts('TitleFont') and in Pearl Data specifies font = fonts('DocFont').  In the case of the latter, I do not have to repeat the CLASS (or STYLE) statement in my custom template, but only need to change the font family and size in Font.

 

Cynthia included SystemTitle, but my experimentation suggested previously that it was already covered by TitleFont.  I would imagine that each location is covered by reference or inheritance, but I would still be interested in a listing of each for each style template/procedure.

 

I appreciate the advice and corrections.

 

Thank you,

 

Kevin

 

Cynthia_sas
SAS Super FREQ
Hi:
You can get a listing of each style template by using PROC TEMPLATE syntax. Please refer to this paper for an example of PROC TEMPLATE "utility" syntax:
https://support.sas.com/resources/papers/proceedings09/227-2009.pdf

and to this paper for an explanation of the way inheritance works in SAS 9.2 and higher:
https://support.sas.com/resources/papers/proceedings10/033-2010.pdf

If you look at the template "master" BASE.TEMPLATE.STYLE, you will see that SystemTitle inherits from TitlesAndFooters style element:
style SystemTitle from TitlesAndFooters
"Controls system title text.";

To see the inheritance between style elements--
Pearl inherits from Printer which inherits from Default which inherits from Base.Template.Style. So when you are tracing inheritance (which you needed to do more in 9.1.3 than in 9.2 and higher), you can't just go to the previous template, sometimes, you have to go all the way back to the father, grandfather and greatgrandfather template.

But, as I explained in my paper and as Kevin Smith explained here -- style inheritance was enormously simplified starting with SAS 9.2: http://www2.sas.com/proceedings/sugi31/053-31.pdf

cynthia

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
  • 4 replies
  • 8510 views
  • 3 likes
  • 3 in conversation