The SAS Output Delivery System and reporting techniques

Remove extraneous headers and footers in RTF output

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Remove extraneous headers and footers in RTF output

The code below won't run properly without having to exit SAS completely and starting a new SAS session.  Running the file the first time produces correct output.  Running the file a second time results in the table in the attached TEMP.RTF file.  Extra header and footer lines are displayed and the remaining ones are misaligned; 'Organization' should be on the same line as 'Page 1 of 1', and 'My program' should be on the same line as 'Date 1.'    The SAS code used is as Follows:

title1 j=left font='Arial' 'Organization' j=right "Page ~{pageof}";
title2 j=left font='Arial' 'Study';
footnote1 j=left font='Arial' 'My program' j=right "Date 1";
footnote2 j=right font='Arial' "Date 2";

 

options formchar="|____|+|___+=|_/\<>*" pageno=1 nonumber nodate orientation=landscape center;
ods listing close;
ods rtf file="&outpath.\filename.rtf"  style= journal;  
ods escapechar='~';
 ***;

proc report data=mydat nowindows split='^' style(column)={asis=on} 
        style(report)={font=('Arial',9.5pt,bold italic) 
                       pretext="Table 1"};
	column group person enrolled startdt enddt variable3 variable4 comments;
	define group / display center id 'group' style=[CellWidth=11%];
	define person / display center id 'person' style=[CellWidth=10%];
	define enrolled / display center 'enrolled' style=[CellWidth=11%];
	define startdt / display center 'Study Start Date' style=[CellWidth=11%];
	define enddt / display center 'Study End Date' style=[CellWidth=10%];
	define variable3 / display center 'Variable 3' style=[CellWidth=10%];
	define variable4 / display center 'Variable 4' style=[CellWidth=15%];
	define comments / display center 'Comments' style=[CellWidth=20%];
run;

ods rtf close;
ods listing;
title; footnote;

Thank you in advance for any ideas!

 

Numbergirl


Accepted Solutions
Solution
‎11-10-2017 03:02 PM
Occasional Contributor
Posts: 5

Re: Remove extraneous headers and footers in RTF output

Posted in reply to numbergirl

This worked!  Thanks, Jody!

 

Yes, here is another suggestion. Please insert the STYLE statement underlined below into your PROC TEMPLATE code.  Please run your program again.  If it doesn't help and it wasn't because of a syntax error, please send me a subset of your data that I can test with here.

 

Thanks!

 

 

 

proc template;                                                                 

   define style Styles.new_journal;                                                

      parent = styles.Journal;

   style table from table/

      prehtml='';

 style SysTitleAndFooterContainer from SysTitleAndFooterContainer

  /cellpadding = 0;

   end;

run;

 

Sincerely,

Jody Carlton

SAS Technical Support

 

SAS Technical Support Services and Policies

http://support.sas.com/techsup/support.html

View solution in original post


All Replies
PROC Star
Posts: 7,630

Re: Remove extraneous headers and footers in RTF output

Posted in reply to numbergirl

I think that the problem is in the journal style and I suggest you submit the problem to SAS tech support.

 

If you can get away with using a different style, the following appears to work correctly:

ods rtf file="&outpath./filename.rtf"  style= SAPPHIRE;  

You may have to change the slash to a backslash as you originally had it. I had to use the above since I tested your code on SAS UE and it wouldn't accept the path (i.e., the one I had to use /folders/myfolders) unless I used the forward slash in the above statement.

 

Art, CEO, AnalystFinder.com

 

Occasional Contributor
Posts: 5

Re: Remove extraneous headers and footers in RTF output

Thank your for your reply, Art.  That's interesting, and it does fix the header-footer problems, but alas, it changes the look of the table and I it to be in journal style.   

 

Numbergirl

Occasional Contributor
Posts: 5

Re: Remove extraneous headers and footers in RTF output

Posted in reply to numbergirl
oh - okay, yes, good idea, i'll submit it as a possible issue with the journal style to SAS tech support. thanks again!
Solution
‎11-10-2017 03:02 PM
Occasional Contributor
Posts: 5

Re: Remove extraneous headers and footers in RTF output

Posted in reply to numbergirl

This worked!  Thanks, Jody!

 

Yes, here is another suggestion. Please insert the STYLE statement underlined below into your PROC TEMPLATE code.  Please run your program again.  If it doesn't help and it wasn't because of a syntax error, please send me a subset of your data that I can test with here.

 

Thanks!

 

 

 

proc template;                                                                 

   define style Styles.new_journal;                                                

      parent = styles.Journal;

   style table from table/

      prehtml='';

 style SysTitleAndFooterContainer from SysTitleAndFooterContainer

  /cellpadding = 0;

   end;

run;

 

Sincerely,

Jody Carlton

SAS Technical Support

 

SAS Technical Support Services and Policies

http://support.sas.com/techsup/support.html

Occasional Contributor
Posts: 5

Re: Remove extraneous headers and footers in RTF output

Posted in reply to numbergirl

Also note:  

Using multiple justifications in Title and Footnote statements with Journal style (or parenting from Journal style) requires changing the Cellpadding attribute to 0 in the SysTitleAndFooterContainer.  

 

 Usage Note 57982 has details. http://support.sas.com/kb/57982

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 314 views
  • 0 likes
  • 2 in conversation