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

I'have some problem in rtf contents. My question is :

I want to control the pagebreak by generating a variable of "_pageno" and using proc report to output the listing to rtf, here is my code.

 

data class;
	set sashelp.class;
	if _N_ <=5 then _pageno = 1;
		else if _N_ <=10 then _pageno = 2;
		else if _N_ <=15 then _pageno = 3;
		else if _N_ <=20 then _pageno = 4;
run;

%macro report();
	%do i = 1 %to 4;
		Title "This is Table Title";
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  
		run;
		%end;
%mend report;

%let path = C:\Users\Administrator\Desktop\test;
ods html close;
options missing = "" nodate nonumber orientation =landscape ls=200 center papersize=A4 ;
title;footnote;
ods escapechar='`';

ods tagsets.rtf path = "&path" file="class.rtf" style=tagsetsrtf 
options(contents='yes' toc_data='on' continue_tag='off' toc_level = '1' vspace='off' );

ods proclabel "This is Table of Contents" ;
%report;

ods tagsets.rtf close;
ods html;

here if my result, i dont need the "Report PROCEDURE" displayed in the comtents.

Is there a method to supress the "Report PROCEDURE"?ad2b87eda4721546a8fca165be8b731.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PhilC
Rhodochrosite | Level 12

Taking inspiration from:

Example 1: "Creating a Table of Contents" | SAS Help Center: ODS TAGSETS.RTF Statement

I made this change to the Macro report()

%macro report();
  %let i=1;
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  run;
	%do i = 2 %to 4;
    ods tagsets.rtf options(toc_data='no');
		Title "This is Table Title";
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  run;
  %end;
%mend report;

 This left justifies the tables 2 through 4 for me... IDK why? Hopefully that's something you can apply code to.

View solution in original post

2 REPLIES 2
PhilC
Rhodochrosite | Level 12

Taking inspiration from:

Example 1: "Creating a Table of Contents" | SAS Help Center: ODS TAGSETS.RTF Statement

I made this change to the Macro report()

%macro report();
  %let i=1;
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  run;
	%do i = 2 %to 4;
    ods tagsets.rtf options(toc_data='no');
		Title "This is Table Title";
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  run;
  %end;
%mend report;

 This left justifies the tables 2 through 4 for me... IDK why? Hopefully that's something you can apply code to.

Jinlf
Calcite | Level 5

Thank you very much. 

My problem has been resolved perfectly by you codes.  A small adjustments to you code. like this.

%macro report();
  %let i=1;
        Title "This is Table Title";
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  run;
	%do i = 2 %to 4;
    ods tagsets.rtf options(toc_data='no');
		Title "This is Table Title";
		proc report data=class (where=( _pageno = &i.)) nowd split='|' ;  run;
  %end;
%mend report;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 2 replies
  • 1352 views
  • 0 likes
  • 2 in conversation