BookmarkSubscribeRSS Feed
AS1
Calcite | Level 5 AS1
Calcite | Level 5

How do I apply style attributes to the by-group label in proc report? I want to reduce the font size and can see how to do that for just about every aspect of the report except the by-group label.

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Good question, took me a while to figure it out.  You need two components, first turn off the default byline printing in the options statement, then add a title statement in with the font/size info:

ods rtf file="...\temp.rtf" style=statistical;
options nobyline; /* This is key to note have default printing */
proc report data=sashelp.cars nowd;
  columns make model type origin;
  by make;
  title1 f='Sas Monospace' h=8pt '#byvar(make)' ; /* Set your font, size etc. here */
  define make / noprint;
run;
ods rtf close;

 

To note, I generally create my reports slightly different, and if you want a different approach try the below - it can be more flexible if you want to change fonts, or display, or pretty much anything between by groups:

proc sql;
  create table LOOP as
  select distinct MAKE
  from SASHELP.CARS;
quit;
ods _all_ close;
ods rtf file="s:\temp\rob\temp.rtf" style=statistical;
data _null_;
  set loop;
  call execute('title1 h=6pt font="SAS Monospace" "'||strip(make)||'";
                       proc report data=sashelp.cars nowd;
                         where make="'||strip(make)||'";
                         columns model type origin;
                       run;');
run;
ods rtf close;

Tim_SAS
Barite | Level 11

The byline style is not controlled by PROC REPORT. Instead, it's part of the document style. To change the byline style you'll have to modify the Byline class in the document style you're using (HTMLBlue, Pearl, whatever). You can either make a copy of the entire style template and change Byline, or (easier) just create a new style that has the document style as its parent.

 

See the ODS user's guide, Kevin Smith's book, and the SGF papers about ODS styles.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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