The SAS Output Delivery System and reporting techniques

Page number at top and page break after each proc report entry

Reply
Regular Contributor
Posts: 178

Page number at top and page break after each proc report entry

title  'Title1';

title2  'Title2;

PROC REPORT DATA= test headskip split='*' wrap nowd

style(report)=[background=black cellspacing=10 just=center font_size=9pt font_face="Calibri" bordercolor=black borderwidth=1]

style(column)=[background=white font_size=10pt bordercolor=black borderwidth=1]

  

;

COLUMNS _ALL_;

 

 

DEFINE Disas_Type / Display style(column)={cellwidth=80pt just=center} "Disaster Type";

DEFINE TITLE / Display style(column)={cellwidth=80pt just=center} "Title";

DEFINE STATE / Display style(column)={cellwidth=80pt just=center} "State";

DEFINE Counties / Display style(column)={cellwidth=80pt just=center} "Counties";

 

 

 

run;

ods listing close;

 

Lets say I want to add a page break after Counties and start a new page to insert another proc report and I want to place a page number at the top of each page (Page 1 of 10)  how could I do that

Super Contributor
Super Contributor
Posts: 265

Re: Page number at top and page break after each proc report entry

You could try something like:

 

 

ods pdf file="file.pdf" notoc;

/* Start the page numbering from 1 */
options pageno=1;

proc whatever;
run;

ods pdf startpage=now;

proc whatever;
run;

ods _all_ close;
SAS Super FREQ
Posts: 9,261

Re: Page number at top and page break after each proc report entry

[ Edited ]

Hi, in the LISTING destination, it is very hard to do page numbering, such as you want (Page X of Y).

However for PDF and RTF destinations, it is quite easy. Here's an example using SASHELP.SHOES and SASHELP.CARS.


ods listing close;
ods escapechar='^';
options nodate nonumber pageno=1;

ods pdf file='c:\temp\show_pageXofY.pdf';

title j=c 'My Title' j=r 'Page ^{thispage} of ^{lastpage}';

proc report data=sashelp.shoes(obs=65);
run;
  
title j=c 'Second Report' j=r 'Page ^{thispage} of ^{lastpage}';

proc report data=sashelp.cars(obs=65);
  column make model type origin msrp mpg_highway mpg_city;
run;
 
ods pdf close;

 

 

Hope this helps give you an idea of how to do this for PDF or RTF.
cynthia

Ask a Question
Discussion stats
  • 2 replies
  • 172 views
  • 0 likes
  • 3 in conversation