02-10-2015 12:24 PM
I am developing a SAS macro.
The macro output have two result datasets. For some reasons I want to keep them separately. Is there anyway to print both datasets in the same output page? Because if I call proc print twice, result datasets will be printed in 2 separate page even thought they have only a few rows.
Thanks a lot.
02-10-2015 12:32 PM
Can you provide some example of what you want the output to look like and which output destination you are using?
If you use ODS RTF with the KEEPN and STARTPAGE=NO options the output might fit on one page. You might want to investigate using a different style than the default RTF style to one with a smaller font to help.
02-10-2015 05:28 PM
You could go really old style and use PUT statements to write your report.
file print header=pagetop;
if not eof1 then do;
set dataset1 end=eof1;
put some stuff on the left hand side of the page @;
if not eof2 then do;
set dataset2 end=eof2;
put some stuff on the right hand side of the page;
* Add top-of-page titles/headings, etc.;
Its hard work, but extremely flexible.
02-11-2015 02:48 AM
If you need put them together in a page vertically , add ods option startpage=never ,
or if you want side by side.
Then You need some advanced skill of ODS.
Code is take from a SAS book of Arthur.Carpenter
ods listing close; ods pdf style=sasweb file="c:\temp\x.pdf"; ods layout start; ods region x=.5in y=.1in width=3in height=4in; proc report data=sashelp.prdsale(where=(prodtype='OFFICE')) nowd; run; ods region x=5in y=.1in width=3in height=4in; proc report data=sashelp.prdsale(where=(prodtype='FURNITURE')) nowd; run; ods layout end; ods pdf close; ods listing;
Message was edited by: xia keshan
02-12-2015 09:32 AM
02-12-2015 10:07 AM
basic code for RTF (Word) output would be:
ods rtf file="c:\myfolder\mydocument.rtf" startpage=no;
proc print data=dataset1;
proc print data=dataset2;
ods rtf close;
There are lots of options involved in the ODS RTF statement that relate to style, table of contents and how titles appear. If you want separate titles for you two data sets you will likely want the option Bodytitle on the ODS RTF statement.