BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Lord_Sapens
Fluorite | Level 6

Hi,

 

I'm trying to add a contents table in a rtf file. As I saw in other discussions and examples, the code is something like:

 

"ods rtf file="myfolder\Table_X.rtf" style=Journalvs CONTENTS toc_data;"

 

Everything fine, and in the rtf output, the table of contents is created and when I update the field, the contents appear. The problem is about the headers and footnotes. I have defined this headers and footnotes for the entire document, and I change it in each report, but, the TOC seems to be in a separated section of the document, and these titles are not populated. How can I add them? 

Lord_Sapens_0-1715695938533.png

 

Also, and this is minnor at this time, I would like to know how to change the font size of the TOC elements, I tryied with proc template, but with any change.. 

 

 

The code: 

options orientation=landscape replace center nodate nonumber ;
ODS LISTING CLOSE;
ods ESCAPECHAR='^';


Title1 J=l "Study 1" J=R "Page ^{thispage} of ^{lastpage}";
Footnote1 J=L " myself";

ods rtf file="myfolder\Table_X.rtf" style=Journalvs CONTENTS toc_data;


title2 J=l "Table 1. Baseline and disease categorical characteristics.";
Footnote1 j=l "P-values obtained from Fisher exact test(*) or simulated MC Fisher test (#).; NA: Not apply.";
Footnote2 J=L " myself";


ODS PROCLABEL=' '; 
proc report data=tmp.cats contents='Table 1' center style(report)={just=center} style(header)=[background=white bordercolor=black borderbottomwidth=0.1pt vjust=center] nowd split="@" style(column)=[bordercolor=white];
column order_1 order_2 order_3 col1 col2;


column order_1 order_2 order_3 col1 col2;


define order_1 / order noprint;
define order_2 / order noprint;
define order_3 / order noprint;
define col1 / display "Group" left style(column)=[cellwidth=10% asis=on];
define col2 / display "Parameter" left style(column)=[cellwidth=15% asis=on] style(header)=[bordertopwidth=0pt];

compute before order_2 / style=[just=l font_face=Courier font_size=8pt font_weight=bold foreground=black background=white];
line j=l " ";
endcomp;

compute before order_2 / style=[just=l font_face=Courier font_size=8pt font_weight=bold foreground=black background=white];
line j=l " ";
endcomp;


break after order_1 / page contents=' ';
break before order_1 / page contents=' ';

run;

title2 J=l "Table 2.";
Footnote1 j=l "P-values obtained from t-test of equal or unequal (**) variances.; NA: Not apply.";
Footnote2 J=L "myself";

ODS PROCLABEL=' '; 
proc report data=tmp.conts contents='Table 2' center style(report)={just=center} style(header)=[background=white bordercolor=black borderbottomwidth=0.1pt vjust=center] nowd split="@" style(column)=[bordercolor=white];
column order_1 order_2 order_3 col1 col2;


define order_1 / order noprint;
define order_2 / order noprint;
define order_3 / order noprint;
define col1 / display "Group" left style(column)=[cellwidth=10% asis=on];
define col2 / display "Parameter" left style(column)=[cellwidth=15% asis=on] style(header)=[bordertopwidth=0pt];

compute before order_2 / style=[just=l font_face=Courier font_size=8pt font_weight=bold foreground=black background=white];
line j=l " ";
endcomp;

break after order_1 / page contents=' ';
break before order_1 / page contents=' ';
run;

ods rtf close;
ods html close;
ods listing;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Lord_Sapens
Fluorite | Level 6

Hi again, 

 

I'm autoresponding me, I think that I found a "solution", with some trick.. Using this at the beggining: 

 

ods rtf text="{\pard\f2\b\fs32\qc {Index of Tables}
\par\cell}{\row}\pard{\field{\*\fldinst {\\TOC \\f \\h \\e "" "" \\c ""4"" \\z ""1033""
}}}\par\trowd\trgaph180\cellx1440\pard\intbl{}";

ods rtf notoc_data;
	ODS PROCLABEL=" "; 
      data _null_;
            file print;
			put "^S={borderbottomwidth=0 bordertopwidth=0 bordercolor=white borderbottomcolor=white}";
		run;
 ods rtf toc_data;
ODS RTF startpage=yes; 

For now, it will do my choice. If any one have more elegant solution, I'm open ! 

 

Thanks a lot. 

View solution in original post

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi: You may want to work with SAS Tech Support on this. I do not think that SAS Titles or Footnotes are ever visible on the TOC page. There may be a workaround for that by writing your own code to generate a Table of Contents, but it may not be worth the effort. Then, I remember reading/hearing about how some of the TOC elements could not have the font changed by changing the style template. What I don't know is whether these types of changes are different in ODS WORD. So, your best resource on this might be SAS Tech Support.
Cynthia

Lord_Sapens
Fluorite | Level 6

Hi Cynthia,

 

Thank you for your response! I always use this website for consultation, but never for asking, and seems that the community responds very quick.

 

I was looking for an answer of that the entire day yesterday, at least, I have now a bit confirmation. 

 

My other option was to use something like that, that I found in some manuscripts of Lax Jensen and others (actually, I think that your name was in some of them?):

 

ODS RTF TEXT="{\pard\b\fs28\qc {Table of Contents} \par}"; 
ODS RTF TEXT="{\field{\*\fldinst {\\TOC \\f \\h}} \par }"; 

but, in this case, I had other two issues. Although the table is created, the pages are not showed (the concepts yes, i.e. "Table 1 ........." without the page number), and doesn't appear in a distinct page. I mean, the table has shown just before the first table. Maybe you or some other have a solution for this second option issues? I don't know if it is possible to add a pagebrake using the "RTF lenguage" for example, or if this works. I completely naive in RTF coding. 

 

Thank you in advance! 

 

Lord_Sapens
Fluorite | Level 6

Hi again, 

 

I'm autoresponding me, I think that I found a "solution", with some trick.. Using this at the beggining: 

 

ods rtf text="{\pard\f2\b\fs32\qc {Index of Tables}
\par\cell}{\row}\pard{\field{\*\fldinst {\\TOC \\f \\h \\e "" "" \\c ""4"" \\z ""1033""
}}}\par\trowd\trgaph180\cellx1440\pard\intbl{}";

ods rtf notoc_data;
	ODS PROCLABEL=" "; 
      data _null_;
            file print;
			put "^S={borderbottomwidth=0 bordertopwidth=0 bordercolor=white borderbottomcolor=white}";
		run;
 ods rtf toc_data;
ODS RTF startpage=yes; 

For now, it will do my choice. If any one have more elegant solution, I'm open ! 

 

Thanks a lot. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 331 views
  • 1 like
  • 2 in conversation