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

Hello SAS community,

 

I produced a simple report using PROC REPORT and the sashelp.cars dataset.  The code I used to produce the simple report can be found below this message. I also attach to this post a modified version of the "borders.rtf" file that was generated by the program.  I have modified the "borders.rtf" file in the following ways:

 

I added a page break so the document consists of 2 pages.  On page 1 is the original report produced by the SAS code below. I copied the original report on page 1 and pasted it on page 2.  I then modified this original report on page 2 with the table tools menu in Microsoft word.

 

My question is: how can I modify my program below so that when I run the modified program, it will automatically produce the report as can be seen on page 2 of the attached .rtf file? In other words, how can the program be modified to produce the following stylistic modifications:

 

1. Top and bottom borders of the entire report table should have a weight of 1.5 pts.

2. There should be a bottom border underlining the entire header row (basically underlining "DriveTrain Asia Europe USA") with 0.5 pt weight.

3. There should be a bottom border for only the cell that contains the word "Region" with a 0.5 pt. weight.

(A related question is, if there was another nesting, say for "Type", could both "Type" and "Region" be targeted with this kind of isolated bottom border?)

4. All of the header text should be italicized, only. No Bold text. font=Arial; fontsize=9.5 pts.

5. All text in the detail portion of the report should be font=Arial; fontsize=9.5 pts.

6. There should be no other borders visible.

7. The default gray background color in the header region of the original report should be removed.

 

%let path=C:\Users\*****\Desktop;
ods rtf path="&path";
ods rtf file="borders.rtf";

proc report data=sashelp.cars ;
column drivetrain ('Region' origin);
define drivetrain/group;
define origin/across ' ';
title 'with borders';
run;

ods rtf close;

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  You'll have to use the techniques outlined in this paper https://support.sas.com/resources/papers/proceedings10/033-2010.pdf to modify the style template. You'd either use styles.rtf as your parent template or use styles.journal as your parent template.

 

  Remember that specifying a font size in PT really only works for fonts. If you specify anything else in points, such as column width or border thickness, your PT specification (or your IN or CM or Pixel units) all get translated to TWIPS (twentieth of a printers point). So that's why I only use PT sizes for fonts and I typically don't bother changing border thickness because any number I specify will be converted to TWIPS anyway. Here's a Tech Support note that discusses how the final setting you see might be different because of the TWIP conversion: http://support.sas.com/kb/57/874.html .That's why I don't bother changing border lines for RTF, but just take the defaults that are used.

 

  Even though you could change all the fonts to Arial in the style template, you can also change all the fonts in PROC REPORT style overrides, such as I have shown. The list of most common font-related style attributes that you might want to override are: font_face, font_weight, font_style and font_size. You can look them up in the documentation here: https://go.documentation.sas.com/?docsetId=odsug&docsetTarget=p0xi2cygmfk0wkn1ei625zq5r488.htm&docse... .

 

Hope this helps,

Cynthia

View solution in original post

8 REPLIES 8
Cynthia_sas
SAS Super FREQ

Hi:

  Your output looks nearly identical to that produced by the JOURNAL style. I suggest you start there:

ods rtf file="....." style=journal;

 

Cynthia

Varrelle
Quartz | Level 8

But how do I accomplish this programmatically without using the style= option in the ODS RTF statement? To target specific aspects of the report?

 

For example, how can I target the header cell with the word "Region"? Or what if I want Times New Roman font instead of Arial 9.5?

 

 

Cynthia_sas
SAS Super FREQ

Hi:
Did you try the JOURNAL style? That makes the overall look and feel what you want.

 

Next, you investigate specific STYLE overrides, either in the PROC REPORT statement or the DEFINE statement.

I would not try to avoid using a STYLE=JOURNAL in the ODS RTF statement -- that will give me the basic look without any interior table lines.

 

The STYLE overrides are well documented and there have been a lot of previous postings on the subject. This worked for me (I included an example of trafficlighting based on a cell's value -- so I explicitly put N on the COLUMN statement):

style_override_journal.png

 

Cynthia

Varrelle
Quartz | Level 8

Hi Cynthia,

 

Thanks very much for your follow-up response.  Even though your response doesn't fully answer my original question, it still is quite helpful.  Thanks for your effort and support.

 

Best wishes

Cynthia_sas
SAS Super FREQ

Hi:
Personally, instead of fiddling over a style template, I would convince my users to accept Journal style type of lines. This style was designed specifically for clinical reports and journal publications. If you investigate style overrides, then my example does, one way or another, illustrate the answer to most of your questions.

1. Top and bottom borders of the entire report table should have a weight of 1.5 pts.
>>I believe you have to change the style template to do this.<<

2. There should be a bottom border underlining the entire header row (basically underlining "DriveTrain Asia Europe USA") with 0.5 pt weight.
>>Again, this is a style template change.<<

3. There should be a bottom border for only the cell that contains the word "Region" with a 0.5 pt. weight.
>>Use style override for TextDecoration for Region. I showed how to do this. You cannot change the width of this line.<<

(A related question is, if there was another nesting, say for "Type", could both "Type" and "Region" be targeted with this kind of isolated bottom border?)
>>Again, a style override for TextDecoration.<<

4. All of the header text should be italicized, only. No Bold text. font=Arial; fontsize=9.5 pts.
>>Change my examples to take off the font_weight=bold or change it to font_weight=medium. Add font_style=roman for no italic. The default for headers is italic. If you want to explicitly specify italic, then font_style=italic or font_style=slant.<<

5. All text in the detail portion of the report should be font=Arial; fontsize=9.5 pts.
>>I have used Calibri in my examples. You should be able to figure this out. Your other alternative is to change the style teplate for this.<<

6. There should be no other borders visible.
>>This is why you start from the Journal style.<<

7. The default gray background color in the header region of the original report should be removed.
>>This is why you start from the Journal style.<<

Hope this helps.
Cynthia

Varrelle
Quartz | Level 8

Hi Cynthia,

 

Thanks so much for following up.  I agree with you that the Journal style is quite useful for most applications.  Unfortunately, it doesn't quite achieve what I am after; hence my post.

 

I've studied PROC TEMPLATE, and there seems to be a lot going on. So, I totally understand why it is always better to use a pre-loaded style than to make a new one.  Still, I would like to try:

 

If I were going to make a new style definition using PROC TEMPLATE and keeping "Journal" as the parent style, could you advise me on where I would need to make the necessary modifications and what those modifications would need to look like in order to achieve the desired results detailed in items 1, 2, and 5 from my original post? I am focusing on these items because you suggested they would need modification in a style template.

 

Hope you can help me.

 

Thanks.

 

Cynthia_sas
SAS Super FREQ

Hi:

  You'll have to use the techniques outlined in this paper https://support.sas.com/resources/papers/proceedings10/033-2010.pdf to modify the style template. You'd either use styles.rtf as your parent template or use styles.journal as your parent template.

 

  Remember that specifying a font size in PT really only works for fonts. If you specify anything else in points, such as column width or border thickness, your PT specification (or your IN or CM or Pixel units) all get translated to TWIPS (twentieth of a printers point). So that's why I only use PT sizes for fonts and I typically don't bother changing border thickness because any number I specify will be converted to TWIPS anyway. Here's a Tech Support note that discusses how the final setting you see might be different because of the TWIP conversion: http://support.sas.com/kb/57/874.html .That's why I don't bother changing border lines for RTF, but just take the defaults that are used.

 

  Even though you could change all the fonts to Arial in the style template, you can also change all the fonts in PROC REPORT style overrides, such as I have shown. The list of most common font-related style attributes that you might want to override are: font_face, font_weight, font_style and font_size. You can look them up in the documentation here: https://go.documentation.sas.com/?docsetId=odsug&docsetTarget=p0xi2cygmfk0wkn1ei625zq5r488.htm&docse... .

 

Hope this helps,

Cynthia

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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