BookmarkSubscribeRSS Feed
AmitKB
Fluorite | Level 6
Hi,
I want no page number for first page. From second page onwards I want "page 1 of last page" . Total number of pages does not include first page.

Thanks in advance for help,

Amit
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi, assuming you want something like the 2 PROC PRINTs below, you can manipulate the page numbering at a step boundary as shown in the program.

However, if you wanted to run PROC GLM, (for example) and have page 1 without page numbers and then have the rest of the output with page numbers, this is not possible without post processing the output.

In order to get Page X of Y page numbering, you must use ODS ESCAPECHAR functions ^{thispage} and ^{lastpage}. In my program, I show an ESCAPECHAR of ^. If you used a different ESCAPECHAR, (such as ~), then your function calls would change to ~{thispage} and ~{lastpage}.

cynthia
[pre]
options nodate nonumber;
title; footnote;

ods pdf file='change_nums_middle3.pdf';
ods escapechar='^';

proc print data=sashelp.shoes(firstobs=1 obs=33);
title 'My Report from PROC PRINT with no Page Numbers';
run;
title;
footnote;

options pageno = 1;
ods pdf;

proc print data=sashelp.shoes(firstobs=34 obs=120);
title 'Page Numbers Start here (in footnote)';
footnote j=r 'Page ^{thispage} of ^{lastpage}';
run;

ods pdf close;
title;
footnote;
[/pre]
Q1983
Lapis Lazuli | Level 10

ods listing close;

ods escapechar='^';

options nodate nonumber pageno=1;

options nodate nonumber papersize = letter orientation=landscape;

ods noptitle;

ods pdf file="&OutDir/&ReportOut..pdf" style=printer notoc /*startpage=never;*/;

goptions hsize=10 in vsize=11 in;/*9 7*/

 

title j=c 'Mortgage Disaster Impact Analysis'

j=r 'Page ^{thispage} of ^{lastpage}';

title2 justify=center 'Originations Pipeline Impact';

title3 justify= center &wkday. &Date1. &Time1.;

 

 

PROC PRINT DATA = FEMA_IMPACT_CUTOFF noobs

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]  

 

grandtotal_label='Grand Total';

title j=center 'Originations Pipeline Impact';

by Disaster State ;

sum Indiv_Numb Indiv_Doll Publ_Numb Publ_Doll;

label Indiv_Numb = 'Indiv#s';

label Indiv_Doll = 'Indiv$';

label Publ_Numb = 'Public#s';

label Publ_Doll = 'Public$';

RUN;

 

ods pdf close;

goptions reset=all;

ods pdf startpage=yes;

ods listing;

run;

 

As a follow up to this post I inserted the page number logic however I am not getting the page number just the results.  This uses a pdf output

 

Cynthia_sas
SAS Super FREQ

Hi:

  I'm not sure why you posted this in a 9 year old forum posting. However, you have an issue in your code, which is probably the reason why the "pageof" ESCAPECHAR strings are not working.

 

remove_title_statement.png

 

also, not sure why you have a GOPTIONS statement. For PDF to change the papersize, you typically use the PAPERSIZE option in an OPTIONS statement.

 

And, if you are using graph procedures in your production code with page x of y type of formatting, you may want to look at this Tech Support note: http://support.sas.com/kb/33/986.html.which indicates that "pageof" functions may not work with graphics.

 

cynthia

AmitKB
Fluorite | Level 6
Hi Cynthia,
Thanks for your reply. This is what I was looking for.

Thanks,
Amit

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
  • 4 replies
  • 9310 views
  • 0 likes
  • 3 in conversation