BookmarkSubscribeRSS Feed
tinaz5012
Obsidian | Level 7

Hi,

I am using tagsets.rtf to avoid last blank page from ods rtf output. However, if I understand correctly, tagsets.rtf will read one page volume of data once and create one page, so what I get from tagsets.rtf doesn't has last blank page but it has all page with page number "Page 1of 1", which is not acceptable for me either...

here is the template I am using:

proc template;                                                                
   define style Template1 / store = SASUSER.TEMPLAT;                   
      parent = styles.rtf;      
	  style pageno from pageno /
    	font=fonts("strongfont")
    	posttext=" of ^{lastpage} ";
      style fonts /                                                           
         ..................................                                                 
   end;                                                                       
run;

and I am calling this template here:

ods  tagsets.RTF file="&mypath\test.rtf"  style=Template1 options(continue_tag="no"); 

Can anyone please help me here? I would like to avoid last blank page and get correct page number "page 1 of n", many thanks in advance!

4 REPLIES 4
data_null__
Jade | Level 19

Do you need this part?

 

THISPAGE Function

^{THISPAGE}

inserts the current page number.

Tips This function can be used only with the PRINTER, RTF, and TAGSETS.RTF destinations.
You must use Print Preview to view the resolved THISPAGE function output that is generated by the TAGSETS.RTF destination.
Customizing Titles and Page Numbers
tinaz5012
Obsidian | Level 7

Hi @data_null__ ,

Thank you for your reply! I tried this full code and get empty number there:

data example;                                                                                                                           
   set sashelp.class;                                                                                                                      
   do i=1 to 5;                                                                                                                            
      output;                                                                                                                                
   end;                                                                                                                                    
run;                                                                                                                                    
                                                                                                                                        
ods escapechar='^';                                                                                                                     
                                                                                                                                        
ods tagsets.rtf file="&outdir.\myrtf.rtf" uniform; 
                                                                                              
proc report nowd data=example;                                                                                                          
   col i name age sex height weight;                                                                                                       
   define i / order;                                                                                                                       
                                                                                                                                        
   compute after _page_;                                                                                                                   
      line ' compute after Page ^{thispage} of ^{lastpage} or ^{pageof}';                                                                     
   endcomp;                                                                                                                                
                                                                                                                                        
   footnote 'footnote Page ^{thispage} of ^{lastpage} or ^{pageof}';                                                                       
run; 
                                                                                                                                   
ods tagsets.rtf close;  

Here is the output:

Screenshot 2021-10-25 092102.png

Ksharp
Super User
Did you try this options ?

ods tagsets.RTF file="c:\temp\RowRemove2.RTF" options(VSPACE='no');


ods tagsets.RTF file="c:\temp\RowRemove2.RTF" options(VSPACE='yes');
tinaz5012
Obsidian | Level 7

Hi @Ksharp 

thank you for your help, I tried this, but doesn't work

ods  tagsets.RTF file="&testdir.\&test..rtf"  style=&style. options(continue_tag="no" VSPACE='no'); 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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