BookmarkSubscribeRSS Feed
ellouho1
Calcite | Level 5

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.

 

2019-03-26_16-52-01.png

 

Next page:

 

2019-03-26_17-03-59.png

 

Without using the RTF TEXT, the highlighted header is repeated in each page.

 

Could anyone provide a solution?

 

Thanks

12 REPLIES 12
andreas_lds
Jade | Level 19

Does this help: https://support.sas.com/kb/24/032.html

 

EDIT: No this won't help ... sorry.

Reeza
Super User

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.

 

2019-03-26_16-52-01.png

 

Next page:

 

2019-03-26_17-03-59.png

 

Without using the RTF TEXT, the highlighted header is repeated in each page.

 

Could anyone provide a solution?

 

Thanks


 

ellouho1
Calcite | Level 5

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}";

Reeza
Super User
Ok, can you post the full code, using demo data to reproduce the problem.You're using ODS RFT, can you also include your version of SAS, ie SAS 9.4 TS1M5
ellouho1
Calcite | Level 5

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;

Reeza
Super User

Not super helpful, I tried it with all variations and none had repeating headers - using SAS 9.4 TS1M6

andreas_lds
Jade | Level 19
If you want to repeat column-headers you should follow the link I posted.
ellouho1
Calcite | Level 5

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.

andreas_lds
Jade | Level 19

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.

ellouho1
Calcite | Level 5

Yes I tried with both rtf and tagsets.rtf but I got the  same error:

 

image.png

ballardw
Super User

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.

ellouho1
Calcite | Level 5
Yes that's true, as tagsets.rtf does not accept notoc_data as option so I could not provide the table of contents

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 12 replies
  • 2565 views
  • 0 likes
  • 4 in conversation