Can a bar chart and results from a Proc Report be placed on the same page?
I need to create a couple hundred barcharts with their corresponding data in a spreadsheet format directly below and on the same page. Since I have hundreds of these to create, I don't want to export the results to excel and make a couple hundred worksheets. Can two data elements, like a bar chart and results from proc report or proc tabulate be shown on the same page? Is there a way to control the page breaks?
Thanks! Linda
Hi:
ODS RTF and ODS PDF both support the STARTPAGE= option. Depending on your version of SAS, you can try STARTPAGE=NO -- in 9.3, that should work for both PDF and RTF. In earlier versions of SAS, you might have had to use STARTPAGE=NEVER for PDF. But the code below should work for you in 9.3 of SAS.
cynthia
ods listing close;
options nodate nonumber;
ods graphics / reset=all;
ods pdf file='c:\temp\twothings.pdf' startpage=no style=egdefault;
ods rtf file='c:\temp\twothings.rtf' startpage=no style=egdefault;
ods html path='c:\temp' (url=none)
file="twothings.html"
options(pagebreak='no') style=egdefault;
title 'Proc TABULATE';
proc tabulate data=sashelp.class;
class age sex;
var height;
table sex all,
age='Height Statistics by Age'*height=' '*(n mean);
run;
title;
proc sgplot data=sashelp.class;
vbar age /group=sex groupdisplay=cluster;
xaxis type=discrete;
run;
ods _all_ close;
I found where I control it in HTML, but I need to supress page breaks in output to rtf or pdf Here's the html code to supress page breaks:
ods html file="test.html" options(pagebreak='no');
Hi:
ODS RTF and ODS PDF both support the STARTPAGE= option. Depending on your version of SAS, you can try STARTPAGE=NO -- in 9.3, that should work for both PDF and RTF. In earlier versions of SAS, you might have had to use STARTPAGE=NEVER for PDF. But the code below should work for you in 9.3 of SAS.
cynthia
ods listing close;
options nodate nonumber;
ods graphics / reset=all;
ods pdf file='c:\temp\twothings.pdf' startpage=no style=egdefault;
ods rtf file='c:\temp\twothings.rtf' startpage=no style=egdefault;
ods html path='c:\temp' (url=none)
file="twothings.html"
options(pagebreak='no') style=egdefault;
title 'Proc TABULATE';
proc tabulate data=sashelp.class;
class age sex;
var height;
table sex all,
age='Height Statistics by Age'*height=' '*(n mean);
run;
title;
proc sgplot data=sashelp.class;
vbar age /group=sex groupdisplay=cluster;
xaxis type=discrete;
run;
ods _all_ close;
AWESOME!!! I will give this a try right away! I have version 9.2 still.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.