BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DataGuy99
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

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;

 

View solution in original post

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

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;

 

DataGuy99
Calcite | Level 5

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!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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