Dear users,
I am trying to generate a table of contents using this statement before each PROC REPORT:
ods rtf text="^S={outputwidth=100% just=l fontsize=1} {\tc\fs0\cf8 Title1}";
The table of contents was successfully created but the Headers of each table (generated by PROC REPORT) are not repeated in each page if the table is long.
Next page:
Without using the RTF TEXT, the highlighted header is repeated in each page.
Could anyone provide a solution?
Thanks
I don't believe ODS statements are repeated but titles are repeated. What happens if you use a TITLE statement instead?
@ellouho1 wrote:
Dear users,
I am trying to generate a table of contents using this statement before each PROC REPORT:
ods rtf text="^S={outputwidth=100% just=l fontsize=1} {\tc\fs0\cf8 Title1}";
The table of contents was successfully created but the Headers of each table (generated by PROC REPORT) are not repeated in each page if the table is long.
Next page:
Without using the RTF TEXT, the highlighted header is repeated in each page.
Could anyone provide a solution?
Thanks
I was not talking about repeating titles. I am trying to repeat headers of each column in the next page once the table is long.
The statement below doesn't show any title, It is just linking the title to be displayed in the first page of table of contents:
ods rtf text="^S={outputwidth=100% just=l fontsize=1} {\tc\fs0\cf8 Title1}";
Thanks,
SAS version: SAS 9.4 TS1M3
You can check the code below:
Try once by running this code, will find that headers of Table 2 are not repeated.
Then you can put in comment the statement ODS RTF TEXT, you will find that the header is repeated in every page but it is not displayed in table of contents.
ODS ESCAPECHAR="^";
option orientation=landscape;
ods rtf file = "E:\USER10\Test1.doc"
STYLE = SasDocPrinter
nogtitle
nogfootnote
startpage=yes
nobodytitle
notoc_data contents=yes;
title1 "Table 1" j=l;
ods rtf text="^S={outputwidth=100% just=l fontsize=1} {\tc\fs0\cf8 Table 1}";
proc report data = sashelp.class headline headskip nowd split = "@" missing
style(report)=[rules = all
background = white
bordercolor = gray
width=100%
borderwidth = .1 pt
just=center]
style(header)=[frame = box
background = white
bordercolor=gray fontsize=8pt]
style(column)=[fontsize=8pt]
style(lines)=[fontsize=8pt];
column name sex height age weight;
define name / " " left width=110 style(column)={cellwidth=400} group;
run;
ods rtf startpage=now;
title1 "Table 2" j=l;
ods rtf text="^S={outputwidth=100% just=l fontsize=1} {\tc\fs0\cf8 Table 2}";
proc report data = sashelp.demographics headline headskip nowd split = "@" missing
style(report)=[rules = all
background = white
/*cellspacing = 0*/
bordercolor = gray
width=100%
borderwidth = .1 pt
just=center]
style(header)=[frame = box
background = white
bordercolor=gray fontsize=8pt]
style(column)=[fontsize=8pt]
style(lines)=[fontsize=8pt];
column name region pop totalfr gni MaleSchoolpct;
define name / " " left width=110 style(column)={cellwidth=400} group;
run;
ods rtf close;
Not super helpful, I tried it with all variations and none had repeating headers - using SAS 9.4 TS1M6
Using Uniform option, I was not able to create the table of contents:
26 ods rtf file = "E:\USER10\Test1.doc"
27 STYLE = SasDocPrinter
28 nogtitle
29 nogfootnote
30 startpage=yes
31 nobodytitle
32 notoc_data contents=yes uniform;
-------
22
202
ERROR 22-322: Syntax error, expecting one of the following: ;, ANCHOR, AUTHOR, BASE, BODY, BOOKMARK, BOX_SIZING, CHARSET, CLOSE,
COLUMNS, CONTENTS, CSSSTYLE, DATAPANEL, DOM, DPI, ENCODING, FILE, FONTSCALE, GFOOTNOTE, GTITLE, HOST, IMAGE_DPI,
KEEPN, LSTPIPE, NEWFILE, NOCONTENTS, NOGFOOTNOTE, NOGTITLE, NOKEEPN, NOLSTPIPE, NOOUTLINE, OPERATOR, OUTLINE,
PACKAGE, PATH, RECORD_SEPARATOR, SAS, SASDATE, SGE, STARTPAGE, STYLE, TEXT, TITLE, TRANTAB.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
You have to change
ods rtf
to
ods tagsets.rtf
See the linked article.
But using
ods rtf file="&STUDIOPARENTDIR/odsrtf.rtf" ;
title "This is a title";
data class;
set sashelp.class;
do i=0 to 1 by .1;
age=age+i;
output;
end;
run;
proc tabulate data=class missing;
class sex age;
var height weight;
table sex*(age*all) all , weight height*f=comma8.;
keylabel all='Total' sum=' ';
run;
ods rtf close;
column-headers are repeated.
Yes I tried with both rtf and tagsets.rtf but I got the same error:
NOTOC_DATA is not listed as an option for ODS tagsets.rtf.
Just as Uniform is not an option for ODS RTF.
Yes it is frustrating that two similar outputs have some options in common but not others.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.