BookmarkSubscribeRSS Feed
helenndp
Calcite | Level 5

Hi,

 

I am trying to get page x of y in pdf output. in case of footnote or title 'Page ~{thispage} of ~{lastpage}' is working properly. But this title or footnote is created as page title or footnote. But i want this as table title as right justified. So I used following command.

 

ods pdf style=pearl file='/folders/myfolders/Report2.pdf';
ods escapechar="~";
proc report data=report2mod1 style=[frame=void rules=none]
style(header)=[borderbottomcolor=black];
options nodate nonumber;
column maincat cat subcat val;
define maincat / display '' group order order=data;
define cat / display group noprint order order=data;
define subcat / display '' group order order=data style(column)=[cellwidth=2in];
define val / display 'VAL' style=[just=d];
compute after cat;
line '';
endcomp;
compute after / style=[just=l];
line 'This is test report';
endcomp;
compute before _PAGE_/ style=[just=l];
line @1'protocol' @80'Page ~{thispage} of ~{lastpage}';
line @1'population' @72'final analysis' ;
endcomp;
run;
ods pdf close;

 

But in the final pdf it is showing as in title protocolpageof_. if this not the right way plz tell me how to do this. I am using SAS university edition. 

 

 

Thanks in advance 

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

I do not believe that {thispage} and {lastpage} will work in a LINE statement. They are intended for use with a SAS title or footnote. Your text in the LINE statement is NOT a title, even though you have COMPUTE BEFORE _PAGE_ -- if you note, the text will be inside the table proper and will not sit "outside" the table, as a title or footnote does.

Here's an example of using the Page X of Y in the title instead of COMPUTE block.

cynthia

 

title_compare_compute_before.png

helenndp
Calcite | Level 5

Thanks for the reply.

 

But if you see, title with left justification always starts from page left margin. But if I want it to start from table left margin then what should I do? I tried to adjust page margin but it messed up the table.

Another question is if I use right justification for page no in title then similarly it starts from right page margin of the paper, I want it on table right margin and also there is another right justified title 'final analysis'. Though it starts from right i want it to start just under page x of y where 'p' of the page starts. Please help me with it.

 

Thanks

 

Helenndp

 

Ksharp
Super User
Try ods text=.............


ods text=' ~S={just=right}  xxxxxxxxxxx ';

Cynthia_sas
SAS Super FREQ
I do not believe page numbers will work in ODS TEXT either.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1974 views
  • 2 likes
  • 3 in conversation