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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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