BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
Can I reset Page numbers on PAGEBREAKS

I have a consolidated report for all departments. Report was generated as text file from EG project using List data. I am using PAGE BREAK on Department Code.

Can I reset the Page number to 1 after every page break
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
Between EACH procedure, you can reset PAGENO to 1 :
[pre]
options pageno=1;
proc print data=sashelp.shoes (obs=50);
run;

options pageno=1;
proc print data=sashelp.prdsale(obs=50);
run;
[/pre]

However, this technique will not work for HTML.

And, although this technique will work for LISTING, RTF and PDF, the pages will start at 1 and increment to the end. In other words, the pages generated "internally" by a procedure cannot be restarted (as you have discovered). For example, in the code below, the PAGEBY will cause every Region to start on a new page. However, the page numbers will start at 1, but will be consecutively numbered (about 12-13 pages for all of SASHELP.SHOES):
[pre]
options pageno=1;
proc print data=sashelp.shoes;
by region;
pageby region;
run;
[/pre]

Unless you do something like this:
[pre]
options pageno = 1;
proc print data=sashelp.shoes;
where region = 'Asia';
run;

options pageno = 1;
proc print data=sashelp.shoes;
where region = 'Canada';
run;
[/pre]

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 2034 views
  • 1 like
  • 2 in conversation