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
SAS Super FREQ
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
SAS Super FREQ
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
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1740 views
  • 0 likes
  • 2 in conversation