BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
_Hopper
Obsidian | Level 7

When using a by statement in a procedure, how do you control the font family and size in the printed output for the "by" line?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Here is an example that changes the appearance of a byline (with added text to show where) using the option NOBYLINE to suppress default appearance and use of the Title (or Footnote) option #byline with options applied:

 

proc sort data=sashelp.class out=work.class;
   by sex;
run;

options nobyline;
ods rtf file="x:\example.rtf" nogtitle;
title1 "Title line one";
title2 "replace by line: " Bold color=Red font=Courier height=25pt "#byline";
proc sgpanel data=work.class;
  by sex;
  panelby age/columns=3 ;
  scatter x=height y=weight;
run;

ods rtf close;

options byline;

Instead of #byline you may want to just use #byval, for the variable value, and/or #byvar for the name in customizing the appearance of the title line using the special variables. IF you have more than one variable on your by line then use #byvarN and #byvalN , with N the numeric position on the by line of the variable to reference the values.

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

Hi:

  it depends on the destination and possibly on the procedure you're using, but typically, you need to change the style template. Here's an example using ODS HTML:

Cynthia_sas_0-1722353903814.png

  If you are using OPTIONS NOBYLINE and inserting by group information in the TITLE, then you have other options for changing the font, color, etc, by using the options in the TITLE statement (as shown in the code where the title color and size are changed.

Cynthia

_Hopper
Obsidian | Level 7

Cynthia,

 

This would be in the SGPANEL procedure sent to the RTF destination.

Cynthia_sas
SAS Super FREQ

Hi:
That would have been nice to know up front. Are you using both the standard BY line and the PANELBY statement?
The BY line change and the TITLE change will both work with ODS RTF. If you are also using PROC SGPANEL, you may need to specify NOGTITLE to get the destination to control the titles and bylines. But I think that the PANELBY might stay inside the image. Do you have any sample code that you've tested with?
Cynthia

Just changing my original code a bit, you can see that the STYLE template change works for RTF too:

Cynthia_sas_0-1722392766165.png

 

ballardw
Super User

Here is an example that changes the appearance of a byline (with added text to show where) using the option NOBYLINE to suppress default appearance and use of the Title (or Footnote) option #byline with options applied:

 

proc sort data=sashelp.class out=work.class;
   by sex;
run;

options nobyline;
ods rtf file="x:\example.rtf" nogtitle;
title1 "Title line one";
title2 "replace by line: " Bold color=Red font=Courier height=25pt "#byline";
proc sgpanel data=work.class;
  by sex;
  panelby age/columns=3 ;
  scatter x=height y=weight;
run;

ods rtf close;

options byline;

Instead of #byline you may want to just use #byval, for the variable value, and/or #byvar for the name in customizing the appearance of the title line using the special variables. IF you have more than one variable on your by line then use #byvarN and #byvalN , with N the numeric position on the by line of the variable to reference the values.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 615 views
  • 2 likes
  • 3 in conversation