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?
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.
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:
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
Cynthia,
This would be in the SGPANEL procedure sent to the RTF destination.
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:
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 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.