BookmarkSubscribeRSS Feed
LGoldman
Calcite | Level 5

I'm running a PROC REPORT with an ods PDF destination.  I'm using a BY statement in the PROC REPORT. I can't figure out how to modify the font_size, font_weight etc... on the BY line. The text display on the title lines, column headers and the main body of the report have have all been modified, so the fact that the BY line has not ben modified sticks out like a sore thumb.

Is there a way to modify the style for the BY line?

Thank you,

Lori

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  How did you modify everything else?? With a STYLE= override in PROC REPORT or with a style template change?

cynthia

LGoldman
Calcite | Level 5

With STYLE= override in PROC REPORT.

Cynthia_sas
SAS Super FREQ

Hi:

  There are 3 ways to modify the BYLINE. I've listed them from easiest to hardest (in my opinion).

1) Turn off the normal BYLINE and use #BYVAL or #BYVAR in the TITLE statement

2) Use ODS ESCAPECHAR in the LABEL for the BY variable

3) Change the style template that you are using

  PROC REPORT is only one of the procedures that supports BY group processing. So, there's no STYLE= override available for the BY statement. For example, it would be inappropriate to use any STYLE overrides with PROC SORT. So, there's not a direct STYLE= override method.

  The code below illustrates all 3 methods.

cynthia

proc sort data=sashelp.class out=class;

  by age sex name;

  where age in (12, 13);

run;

  

** Method1;

ods pdf file='c:\temp\method1.pdf';

   

options nobyline;

proc report data=class nowd;

  title '1) Use #BYVAL';

  title2 f='Courier New' h=14pt c=purple bold '#byvar1: #byval1';

  by age;

  columns sex name height  weight;

run;

options byline;

ods pdf close;

  

** Method2;

ods escapechar='^';

ods pdf file='c:\temp\method2.pdf';

     

proc report data=class nowd;

  title '2) Use ODS ESCAPECHAR';

  by age;

  columns sex name height  weight;

  label age = '^S={font_face="Courier New" fontsize=14pt color=purple}Age';

run;

ods pdf close;

  

** Method3;

ods path work.tmp(update) sasuser.template(update)

         sashelp.tmplmst(read);

              

proc template;

  define style styles.method3;

    parent=styles.printer;

    class byline /

      font_face='Courier New'

      color=purple

      font_size=14pt

      font_weight=bold;

  end;

run;

  

ods pdf file='c:\temp\method3.pdf'

        style=styles.method3;

  

proc report data=class nowd;

  title '3) Use Style Template';

  by age;

  columns sex name height  weight;

run;

  

ods pdf close;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1180 views
  • 0 likes
  • 2 in conversation