DATA Step, Macro, Functions and more

style attributes in proc report

Reply
Learner AS1
Learner
Posts: 1

style attributes in proc report

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.

Super User
Super User
Posts: 7,407

Re: style attributes in proc report

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;

Super Contributor
Posts: 394

Re: style attributes in proc report

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.

Ask a Question
Discussion stats
  • 2 replies
  • 178 views
  • 0 likes
  • 3 in conversation