BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Niugg2010
Obsidian | Level 7

In the ods rtf output, I want to include contents inside.

below is my code and I got output like this:

Actually I only want to keep red marked part. I want to replace the blue marked text, using "Contents" instead of  "Table of contents"

In addition, I want to change the font size and style of contents.

How can I revise my code?

 

Thanks

 

try.JPG

 


ods rtf file='XXXXX\try.rtf' contents=yes toc_data bodytitle;

options nobyline;

proc sort data=sashelp.class out=class; by sex; run;
proc report data=class nowindows contents='table1: aaaaaaaaa';
column name sex age height weight;
by sex;
footnote 'Measurements are in metric tons.';
run;

proc report data=class nowindows contents='table2: bbbbbb';
column name sex age height weight;
by sex;
footnote 'Measurements are in metric tons.';
run;
ods rtf close;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

Hi:

  That extra "Table 1" node is something that PROC REPORT introduces. To get rid of that, you have to use a technique from this Tech Support note: http://support.sas.com/kb/31/278.html. 

 

  To do without the BY groups, you'd have to actually NOT use the BY statement. You could move to using PAGE instead of BY with PROC REPORT. But that means one of your variables (most likely SEX) for this scenario has to be a GROUP or ORDER variable.

 

  Also, ODS PROCLABEL will get rid of the "top" node in the table of contents.

 

  Here's something I mocked up -- program and output shown below.

 

cynthia

 

proc_report_revise_toc.png

View solution in original post

7 REPLIES 7
Cynthia_sas
Diamond | Level 26
Hi:
Your report has by group processing turned on -- so you are getting contents for every BY group. Your highlighting implies that you want to see the contents only for the F bygroup, but not for the M bygroup? Is this correct?

cynthia
Niugg2010
Obsidian | Level 7

When you open the figure attached. You can see 'Table 1' index , I do not want the "Table 1".  

I only want to keep The index of "Table 1: aaaaaaaaaaaa" and 'Table 2: bbbbbbbbbbbbbbbbbbbbbbb'.

If you have a method to control the display of "F bygroup" and suppress the 'M bygroup' it will be great.

 

Cynthia_sas
Diamond | Level 26

Hi:

  That extra "Table 1" node is something that PROC REPORT introduces. To get rid of that, you have to use a technique from this Tech Support note: http://support.sas.com/kb/31/278.html. 

 

  To do without the BY groups, you'd have to actually NOT use the BY statement. You could move to using PAGE instead of BY with PROC REPORT. But that means one of your variables (most likely SEX) for this scenario has to be a GROUP or ORDER variable.

 

  Also, ODS PROCLABEL will get rid of the "top" node in the table of contents.

 

  Here's something I mocked up -- program and output shown below.

 

cynthia

 

proc_report_revise_toc.png

Niugg2010
Obsidian | Level 7

Thanks a lot.

 

I can not open the link ' http://support.sas.com/kb/31/278.html. '  Can you please send me the file?

Niugg2010
Obsidian | Level 7

If I include a figure inside like below. How can I remove the marked part "The SGPlot Procedure"

?

 

ods rtf file='XXXX\try.rtf' contents=yes toc_data bodytitle;

options nobyline;

data class; set sashelp.class; dummy_c=1; run;


ODS PROCLABEL="Table: class_table";
proc report data=class nowindows contents='';
column dummy_c name sex age height weight;
define dummy_c /group noprint;
break before dummy_c /page contents=' ';
footnote 'Measurements are in metric tons.';
run;

ods graphics on;
ODS PROCLABEL="Figure: class_figure";

proc sgplot data=class;
scatter x=height y=weight / group=sex;
run;

ods rtf close;

 

Capture.GIF

SuzanneDorinski
Lapis Lazuli | Level 10

Use the DESCRIPTION= option on the PROC SGPLOT statement.

 

ods rtf file='XXXX\try.rtf' contents=yes toc_data bodytitle;

options nobyline;

data class; 
  set sashelp.class; 
  dummy_c=1; 
run;


ODS PROCLABEL="Table: class_table";

proc report data=class nowindows contents='';
  column dummy_c name sex age height weight;
  define dummy_c /group noprint;
  break before dummy_c /page contents=' ';
  footnote 'Measurements are in metric tons.';
run;

ods graphics on;

ODS PROCLABEL="Figure: class_figure";

proc sgplot data=class description='';
  scatter x=height y=weight / group=sex;
run;

ods rtf close;
Niugg2010
Obsidian | Level 7

Great Thanks

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 7 replies
  • 3726 views
  • 0 likes
  • 3 in conversation