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
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
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;
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.
sas version : 9.4
os : hpux
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;
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
I did not know about \pagebb. But what about that weird blank cell on pages 2 and above.
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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.