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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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!


 

View solution in original post

2 REPLIES 2
Reeza
Super User

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!


 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 5714 views
  • 2 likes
  • 2 in conversation