and the SAS title and SAS footnote will be placed in the header and footer area of the RTF document. Note that the above technique has nothing to do with PROC REPORT. It is the SAS Title and Footnote statements that are working with RTF control strings. So, the technique will work with any procedure that sends output to ODS destinations -- not just PROC REPORT.
HTML and PDF output files do NOT have header and footer areas, like RTF output files. A SAS title or SAS footnote will go into the document at the appropriate place in the document. So, for PDF output from ODS, the SAS title and SAS footnote will appear on every page. For HTML output, the SAS title will appear at the top of the procedure output in the HTML file and the SAS footnote will be at the end of the procedure output in the HTML file. If the procedure produces HTML output that spans more than 1 printed page, then the SAS title is on printed page 1 and the SAS footnote is on the last printed page of the HTML file.
This syntax, using the TITLE= suboption, places a text string into the browser top navigation area (top browser title bar):
ods html file='c:\temp\something.html' (title='HTML Title');
. . . SAS Code . . .
ods _all_ close;
With some browsers, this suboption MIGHT put the browser bar title "HTML Title" into the header area of the printed HTML file -- but this really is more dependent on the type of browser you are using and whether that browser has a printer interface that uses the browser bar title in this manner. Again, this is not procedure-dependent -- this capability is a feature of ODS that might be interpreted by a browser the way you want when the HTML file is printed (using the browser).
Since you asked specifically about PROC REPORT, there is, within PROC REPORT, the ability to write text to the output file (RTF, PDF or HTML) based on a COMPUTE BEFORE _PAGE_ or COMPUTE AFTER _PAGE_ block of code. However, if you use these kinds of compute blocks to write text, the text goes into the document itself, (and if you're creating RTF -- this means NOT in the header/footer area) If you knew RTF control string syntax, you might be able to write some code that would go into the Header area of the RTF file, but since the SAS title will go there automatically, that seems the easiest way to go with RTF.
Let's say you wanted to do a report for every Region and that you wanted the Region name to be in the header area of the resulting RTF document. Rather than using PROC REPORT capabilities, you might consider using BYGROUP processing like this:
ods rtf file='c:\temp\head_foot_by.rtf';
proc report data=sashelp.shoes nowd;
title 'SAS Title Goes into Header'; title2 'For #byval(region)';
footnote 'SAS Footnote Goes into Footer';
where Region = 'Asia' or Region = 'Canada';
column region subsidiary product sales;
When SAS encounters the #byval(region) reference, it substitutes the value of the current BYGroup value into the SAS title. If you are creating RTF output, then this information goes into the header area of the RTF output file.
If you need to create an output file other than RTF or HTML, then, there is only one other ODS destination that puts information into a "header" area. That is TAGSETS.EXCELXP -- by default, it places the SAS Title into the Header area of the Excel Workbook and the SAS Footnote into the Footer area of the Excel Workbook. Again, this capability has nothing to do with a specific procedure, but is the default way that the ExcelXP tagset treats the SAS title unless you do something other than the default.
But what if we are using macros to write the header and footer on every table. Where do we specify these ODS conditions on the initiation prg or macro prg or the template used to create the listing.
Are you using SAS macro programs or Word macros??? If the macro programs are SAS macro programs, then are they writing RTF control strings WITHOUT using ODS?? Or are they writing RTF control strings WITH ODS?
The information I gave you is still correct. By default, the SAS title goes into the Header area of a Word document and the SAS footnote goes into the Footer area of a Word document. This is different than putting a TABLE header or TABLE footer on EVERY table. Depending on whether you are using BY group processing or not, either COMPUTE BEFORE or COMPUTE BEFORE _PAGE_ might be used to put a TABLE header above a TABLE and a TABLE footer below a TABLE.
This question is probably better handled by Tech Support, as they can look at EXACTLY what your original program is doing and tell you how to change it to achieve your desired results.