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

Hi,

 

I need to create one rtf output using proc report.  There are two proc reports (part 1 and part 2) and I need to page break the two parts. Please help, thank you.

 

 ods listing close;
ods rtf file = "test .rtf" ;

title1='part 1'; proc report data = part1; columns ordx1 aebodsys total1 ;
define ordx1 / descending order order=internal noprint; define aebodsys / order order=internal noprint; define total1 / descending order order=internal noprint;
run;


title1='part 2'; proc report data = part2 ; columns ordx1 aebodsys total1 ;
define ordx1 / descending order order=internal noprint; define aebodsys / order order=internal noprint; define total1 / descending order order=internal noprint;
run;


ods rtf close;
ods listing;

 

1 ACCEPTED SOLUTION

Accepted Solutions
blueskyxyz
Lapis Lazuli | Level 10
ods listing close;ods rtf file = "C:\Users\My\Documents\test.rtf" ; 
title1='part 1';
proc report data = sashelp.class;
	  where sex='M';
	  columns name sex height  ;	  
run;

/*start in a new page;*/
ods startpage=yes;
title2='part 2';
proc report data = sashelp.class;
	  where sex='F';
	  columns name sex height  ;	  
run;
ods rtf close;ods listing;

View solution in original post

3 REPLIES 3
ballardw
Super User

You need to clearly define what you mean by "page break the two parts". As in show an example of what the result looks like. You can make that manually with example columns and dummy data.

 

There are about a half-dozen ways I might interpret that phrase and almost certainly most if not all would not be what you want.

 

If at all practical it is a good idea to include data. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box opened using the </> icon or attached as text to show exactly what you have and that we can test code against.

blueskyxyz
Lapis Lazuli | Level 10
ods listing close;ods rtf file = "C:\Users\My\Documents\test.rtf" ; 
title1='part 1';
proc report data = sashelp.class;
	  where sex='M';
	  columns name sex height  ;	  
run;

/*start in a new page;*/
ods startpage=yes;
title2='part 2';
proc report data = sashelp.class;
	  where sex='F';
	  columns name sex height  ;	  
run;
ods rtf close;ods listing;
Cynthia_sas
SAS Super FREQ
Hi:
By default, every procedure should start a newpage. I am confused though because your first PROC REPORT has all the variables listed as NOPRINT and it appears that your second PROC REPORT uses NOPRINT for all variables too. I would be very curious about what your intention is with the code you've posted. Why are you using NOPRINT for EVERY variable? What output are you getting?
Cynthia.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 3 replies
  • 889 views
  • 1 like
  • 4 in conversation