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

 

Hello,

 

I have a dataset that  contain a breaking page , byte(12) , as shown bellow

 

data test;
attrib a length=$50; 
     a= "aaaa"; output;
     a=byte(12); output;
     a= "bbbb"; output;
     a=byte(12); output;
     a= "cccc"; output;
     a=byte(12); output;
     a= "dddd"; output;
 run ;
 
 
 proc report data=test ;
 col a;
 run ;

 

I use the proc report to display the dataset within an ods PDF / RTF

I would like to break the page when the a variable equal to byte(12) , but the proc report don’t do  that , it display only a blank space.

The are another way to break page by creating a _page variable and add  break before __page / page ; but it is not appropriate because it create a new section for each breaking page

 

Best regard

 

1 ACCEPTED SOLUTION

Accepted Solutions
reznac
Obsidian | Level 7

thank you for this solution 
i have another solution which consists to replace the byte(32) values by "^R'\pagebb'" as follow

ods rtf; 
data test;
attrib a length=$50; 
     a= "aaaa"; output;
     a=strip("^R'\pagebb'") ; output;
     a= "bbbb"; output;
     a=strip("^R'\pagebb'") ; output;
     a= "cccc"; output;
     a=strip("^R'\pagebb'") ; output;
     a= "dddd"; output;
 run ;

 
 proc report data=test ;
 col a;
 run ;
 ods rtf close ; 

best regard 

View solution in original post

7 REPLIES 7
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

Create a page variable containing the observations per page and break on that:

data test;
  length a $50; 
     a= "aaaa"; pge=1; output;
     a= "bbbb"; pge=1; output;
     a= "cccc"; pge=2; output;
     a= "dddd"; pge=2; output;
 run ;
  
proc report data=test ;
  col pge a;
  define pge / group noprint;  /* Or order instead of group */
  define a / "Avar";

  break after pge / page;
run;

 

 

 

 

 

data_null__
Jade | Level 19

This is a very good question.  I don't know the answer.   One way might be to edit the RTF file I do that to remove paragraph marks in RTFs with embedded graphics.  There are 4 paragraph marks that are inserted, by something, that take up a lot of vertical space, but enough about that.

 

Another possibility might be to use PROC DOCUMENT but that may produce the same section breaks I don't know.

 

Hope you get a good answer that's easy.

 

It might be good to know your SAS version and OS.

reznac
Obsidian | Level 7

sas version : 9.4 

os : hpux 

data_null__
Jade | Level 19

This uses a data step to remove the section break but did not work unless I used ODS option BODYTITLE.  I don't know if this will be helpful.

 

data test;
   do page=1 to 2;
      do n = 0 to 4;
         length a $128;
         a = repeat('It is working? ',n);
         output;
         end; 
      end;
   run ;
ods rtf file='~/section.rtf' bodytitle;
title 'title1';
footnote 'Footnote 1';
proc report data=test ;
   col page a;
   define page / order noprint; 
   define a / "Avar";
   break after page / page;
   run;
   ods rtf close;
data _null_;
   infile '~/section.rtf' length=l lrecl=1024;
   file '~/section2.rtf' lrecl=1024;
   input;
   if find(_infile_,'sect\sectd\') then do;
      putlog _infile_;
      _infile_ = transtrn(_infile_,'\sect\sectd',trimn(' '));
      putlog _infile_;
      end;
   put _infile_;
   run;

Capture.PNG

 

 

reznac
Obsidian | Level 7

thank you for this solution 
i have another solution which consists to replace the byte(32) values by "^R'\pagebb'" as follow

ods rtf; 
data test;
attrib a length=$50; 
     a= "aaaa"; output;
     a=strip("^R'\pagebb'") ; output;
     a= "bbbb"; output;
     a=strip("^R'\pagebb'") ; output;
     a= "cccc"; output;
     a=strip("^R'\pagebb'") ; output;
     a= "dddd"; output;
 run ;

 
 proc report data=test ;
 col a;
 run ;
 ods rtf close ; 

best regard 

data_null__
Jade | Level 19

I did not know about \pagebb.  But what about that weird blank cell on pages 2 and above.

 

Capture.PNG

 

 

reznac
Obsidian | Level 7

it is rtf tag to break page 

we can do that alse within ods rtf 

ods rtf text="^R'\pagebb'"; we have the same result 

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
  • 3536 views
  • 2 likes
  • 3 in conversation