I'm trying to create a PDF report containing a lot of small tables and accompanying text. I can fit more than one table per page, so I am using "startpage=no" so multiple tables appear on a page, otherwise the report would be really long. However, tables are being split across two pages when they can't fit on the current page. I would like to start a new page if the table cannot fit on the current page, and ideally start a new page for different sections of the report. How do you add page breaks when using startpage=no?
Not sure if my code is necessary here, but here is my code to open the file:
ods escapechar="^";
ods pdf file="title.pdf" startpage=no;
options nodate;
Thank you for the help!
Use the NOW value for the option.
See the 7th example in the documentation.
ods html close; /* Not needed if using SAS Studio */ options nodate; ods pdf file="file.pdf" notoc startpage=no ; title "Top of the First Page Title"; footnote "Bottom of the first page footnote"; proc report data=sashelp.cars ; col origin enginesize mpg_city; where mpg_highway gt 45; run; title; footnote; ods graphics on / reset noborder; proc sgplot data=sashelp.cars; where mpg_highway gt 45; scatter x=enginesize y=mpg_city; run; ods pdf startpage=now; title "Top of the Second Page Title"; footnote "Bottom of the second page footnote"; proc report data=sashelp.cars ; col make model type; where mpg_highway gt 45; run; title; footnote; proc sgplot data=sashelp.cars; where mpg_highway gt 45; scatter x=enginesize y=mpg_highway; run; ods pdf close; /* Not needed if using SAS Studio */ ods html;
@megsredl wrote:
I'm trying to create a PDF report containing a lot of small tables and accompanying text. I can fit more than one table per page, so I am using "startpage=no" so multiple tables appear on a page, otherwise the report would be really long. However, tables are being split across two pages when they can't fit on the current page. I would like to start a new page if the table cannot fit on the current page, and ideally start a new page for different sections of the report. How do you add page breaks when using startpage=no?
Not sure if my code is necessary here, but here is my code to open the file:
ods escapechar="^"; ods pdf file="title.pdf" startpage=no; options nodate;
Thank you for the help!
Use the NOW value for the option.
See the 7th example in the documentation.
ods html close; /* Not needed if using SAS Studio */ options nodate; ods pdf file="file.pdf" notoc startpage=no ; title "Top of the First Page Title"; footnote "Bottom of the first page footnote"; proc report data=sashelp.cars ; col origin enginesize mpg_city; where mpg_highway gt 45; run; title; footnote; ods graphics on / reset noborder; proc sgplot data=sashelp.cars; where mpg_highway gt 45; scatter x=enginesize y=mpg_city; run; ods pdf startpage=now; title "Top of the Second Page Title"; footnote "Bottom of the second page footnote"; proc report data=sashelp.cars ; col make model type; where mpg_highway gt 45; run; title; footnote; proc sgplot data=sashelp.cars; where mpg_highway gt 45; scatter x=enginesize y=mpg_highway; run; ods pdf close; /* Not needed if using SAS Studio */ ods html;
@megsredl wrote:
I'm trying to create a PDF report containing a lot of small tables and accompanying text. I can fit more than one table per page, so I am using "startpage=no" so multiple tables appear on a page, otherwise the report would be really long. However, tables are being split across two pages when they can't fit on the current page. I would like to start a new page if the table cannot fit on the current page, and ideally start a new page for different sections of the report. How do you add page breaks when using startpage=no?
Not sure if my code is necessary here, but here is my code to open the file:
ods escapechar="^"; ods pdf file="title.pdf" startpage=no; options nodate;
Thank you for the help!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.