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
SAS Super FREQ

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
SAS Super FREQ
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
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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