SAS 9.4 using Proc Tabulate and ODS PDF output. How do I change the style (font, size, color, etc.) of the "level" variable label that prints just above the table that is created by a "by" statement? And a related issue is how to change the content of the label which is currently "level = <value>". Can I eliminate or edit the "level=" part?
Thanks - Tommy
Hi, can you post an example of some code with data or make an example using SASHELP data?
Otherwise it is hard to visualize what you want and are trying to do.
cynthia
Here's a code example that I have which uses SASHELP.SHOES, so you should be able to run the code. Rather than using a style template to alter the normal BYLINE, I tend to use the BY statement and put the BY information in the TITLE because the TITLE statement has the method built in to change color, font, size, etc.
proc sort data=sashelp.shoes out=shoes;
where region in ('United States' 'Canada' 'Western Europe') and
product in ('Boot' 'Slipper' 'Sandal' 'Sport Shoe');
by region product;
run;
proc format;
value $prd 'Boot'='lightgreen'
'Sandal'='lightyellow'
'Sport Shoe' = 'lightblue'
'Slipper' = 'peachpuff';
run;
title; footnote;
options nobyline;
ods pdf file='c:\temp\byvar_in_title.pdf';
proc tabulate data=shoes f=dollar15.2;
title c=purple f="Courier New" h=14pt bold 'For #byval1';
title2 'Plus other changes';
by region;
class region product / style={font_face="Courier New" color=red background=cxDDDDDD};
classlev product / style={background=$prd.};
var sales returns inventory;
table product all*{style=Header{font_size=10pt}},
sales*(sum mean max) returns*(sum mean) inventory*(sum mean);
keylabel All='Summary';
keyword All / style=Header;
run;
ods pdf close;
options byline;
title; footnote;
Hi, can you post an example of some code with data or make an example using SASHELP data?
Otherwise it is hard to visualize what you want and are trying to do.
cynthia
Here's a code example that I have which uses SASHELP.SHOES, so you should be able to run the code. Rather than using a style template to alter the normal BYLINE, I tend to use the BY statement and put the BY information in the TITLE because the TITLE statement has the method built in to change color, font, size, etc.
proc sort data=sashelp.shoes out=shoes;
where region in ('United States' 'Canada' 'Western Europe') and
product in ('Boot' 'Slipper' 'Sandal' 'Sport Shoe');
by region product;
run;
proc format;
value $prd 'Boot'='lightgreen'
'Sandal'='lightyellow'
'Sport Shoe' = 'lightblue'
'Slipper' = 'peachpuff';
run;
title; footnote;
options nobyline;
ods pdf file='c:\temp\byvar_in_title.pdf';
proc tabulate data=shoes f=dollar15.2;
title c=purple f="Courier New" h=14pt bold 'For #byval1';
title2 'Plus other changes';
by region;
class region product / style={font_face="Courier New" color=red background=cxDDDDDD};
classlev product / style={background=$prd.};
var sales returns inventory;
table product all*{style=Header{font_size=10pt}},
sales*(sum mean max) returns*(sum mean) inventory*(sum mean);
keylabel All='Summary';
keyword All / style=Header;
run;
ods pdf close;
options byline;
title; footnote;
So if I want to modify the byline style I need to edit the style template that I am using for the pdf output. I took a look at proc template and the byline has its own section so problem solved. Thank you very much!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.