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
Hi:
How did you modify everything else?? With a STYLE= override in PROC REPORT or with a style template change?
cynthia
With STYLE= override in PROC REPORT.
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.