Looking for advice to embed title/footnote as part of the table (see below - making it easier to copy & paste into the different document)
Options explored so far
1) PROC REPORT - COMPUTE PAGE BEFORE (COMPUTE doesn't support justification option and did not find any reliable option to right-align "page x of y" text in title1 e.g. calculating and inserting BLANK space. In addition, I have a need to center align the title)
2) ODS RTF - BODYTITLE and BODYTITLE_AUX option (displays title/footnote as part of the body but not exactly as part of the table - not easy to select as one object)

The SAS ODS inline styling directive
^{PAGEOF}will produce Page x of y output in the output file. Since the output is a Word field you might need toCtrl-A, F9to compute the field values when the document is opened.The RTF destination renders
TITLEandFOOTNOTEin the header and footer part of the documents, so tricks are needed to produce per-table 'titles' and 'footers'. From my perspective as a document reader, the best place for PAGEOF would be in the header section and not as part of a table header.ODS TEXT= can be used to add paragraphs before and after a
Proc TABULATEthat does statistical reporting. ODS TEXT= will process inline ODS formatting directives (includingPAGEOF). See SAS® 9.4 Output Delivery System: User’s Guide, Fifth Edition, ODS ESCAPECHAR Statement for more info.Depending on the destination STYLE=, such as
ods rtf style=plateau …ODS TEXT might have some outlining or other styling artifacts.If you are rtf hardcore,
ODS TEXT=can also inject rtf codes directly into the destination stream to produce any rtf possible production. In the following example:^S{attr-name=attr-value}is used to force the text container to be 100% of the page width.^{RAWfunction is used to introduce raw rtf coding. Each{of the actual rtf is introduced using{RAW. Note how the RAWs can be (and are) nested.Some procedures, such as
). Also, unfortunately, the pretext= and posttext= values are not processed for ODS styling directives. However, the values can be raw rtf!
Proc PRINThave style options such asstyle(table)=[ … ]in which apretext=andposttext=can be specified, and such texts will be rendered before and after the rtf table -- the texts are not part of the table and would not be 'picked up' in a single click of Word's 'table select' icon (PRETEXT demonstrating inline styling is not honored:
PRETEXT demonstrating as raw rtf passed through (when first character is
{)Proc TABULATEdoes not have astyle(table)option, but theTABLEstatement does have options:/ CAPTION=(rendered whenOPTION ACCESSIBLETABLE;active)TABLEstatement has a page dimension in it's crossings./ STYLE=[PRETEXT='...' POSTTEXT='...']TABULATEdoes not:LINEstatement inProc REPORT)Consider this tabulate example with
accessibletableon for some medical data. Some of the variables are for:Tabulation report
For SAS versions before 9.4M6 you can add a page dimension variable (whose value is inlined ODS stylized text to be the caption) to the output of the precomputation step and specify that variable in the table statement. Something like
and