BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a proc report with a title. I would like to color the background of the title and put a box around it. Any suggestions? My code is below...

ods pdf file='c:\PC_SAS\Test Page.pdf' style=CustPge3 notoc;
title 'Test' ;
proc report data=projects.dataset5;
where dealer_number='0018';
column description cnt amt;
label description = "Compeditor Name"
Cnt = "Transactions"
AMT = "Amount";
run;
ods pdf close;
6 REPLIES 6
Cynthia_sas
Diamond | Level 26
Hi:
It looks like you're already using a custom STYLE template for your output. The easiest thing to do to alter the title would be to look at changing the SystemTitle style element. Depending on the version of SAS that you're using, you may need/want to change the TitleandNoteContainer style element, too.

To put a box around the title, you would use the FRAME style attribute and you would also probably change the BorderColor, BorderWidth and Background style attributes as well.

cynthia
deleted_user
Not applicable
That worked! Thank you!

Now that I have the box around the title, is there a way to split it into 2 lines but keep the frame around that title?
Cynthia_sas
Diamond | Level 26
Hi:
I believe that if you use 2 Title statements, you will get 2 boxes, one around each title statement text string. If this is not what you want to see, then, your choice is to put a "line feed" or "carriage return" into your title string using ODS ESCAPECHAR techniques.

Depending on your version of SAS (9.1.3 vs 9.2), you may have to use slightly different syntax, but the essential technique is to
1) define an escape character with the ODS ESCAPECHAR statement and then
2) use the escape character appropriately in your code to accomplish the change or effect you want.

These papers illustrate the use of ODS ESCAPECHAR for both SAS 9.1.3 and SAS 9.2.
http://www2.sas.com/proceedings/forum2007/099-2007.pdf
http://www.nesug.org/Proceedings/nesug07/cc/cc18.pdf
http://www.nesug.org/proceedings/nesug08/np/np10.pdf
http://www2.sas.com/proceedings/sugi31/227-31.pdf
http://support.sas.com/resources/papers/sgf2008/odspdf.pdf

cynthia
deleted_user
Not applicable
ods escapechar '^' worked for the line break. I ended up using ^n.

Thanks again! Thanks for the great links too!
deleted_user
Not applicable
One last thing, how can the same thing (add border is background color) be done to the title without using the template?
Cynthia_sas
Diamond | Level 26
Hi:
Not sure that you can do this without using a template for tabular output -- there are some new bordertopstyle, borderbottomstyle attributes in SAS 9.2 -- but you'd have to use them with ODS ESCAPECHAR methods and I'm not sure they'd work in all destinations. It's possible that you might do it with CSS -- but if you were going to use CSS, you might as well use a template (and you'd need 9.2 to use the new CSSSTYLE for ODS RTF or ODS PDF).

In SAS/GRAPH programs, the BOX option works on the TITLE statement. But for tabular output, that option isn't used by ODS.

cynthia

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