The SAS Output Delivery System and reporting techniques

getting number of pages in PROC DOCUMENT output

Reply
Contributor
Posts: 23

getting number of pages in PROC DOCUMENT output

Hi all,

Can anyone tell me if there's a programmatic way to obtain the number of pages in a particular ODS DOCUMENT object?

Like, if I generate a bunch of ODS DOCUMENT objects into a document, I can use the LIST statement to view a listing of all those objects. That listing tells me the number, path, type, size in bytes, and so forth.

However, let's say I only wanted to print the very last page (or last n pages) of a certain object. Is that possible?

More generally, let's say I wanted to obtain the total number of pages in a given object, to maybe use CALL SYMPUTX to make it into a macro variable for later use, or something along those lines.

I couldn't figure out a way to do this, and would appreciate any guidance or suggestions.

Thanks!

SAS Super FREQ
Posts: 8,814

Re: getting number of pages in PROC DOCUMENT output

Hi:

  This is a question for Tech Support. I'm not sure there is a way to grab this information from the Document store. When you replay a document object or objects to HTML, there are no physical page breaks -- so the page breaks or number of physical pages is only tied to the destination. And, since you can remove or add page break indicators using ODS DOCUMENT syntax, you are just adding syntax that will be acted on, if the rendering destination uses page breaks.

cynthia

Contributor
Posts: 23

Re: getting number of pages in PROC DOCUMENT output

That makes sense. Thanks.

I guess I wonder if it's possible to determine the number of pages of a PDF from within SAS? Like, if I outputted the first object to a PDF, could I then determine the number of pages it had, and use that info?

SAS Super FREQ
Posts: 8,814

Re: getting number of pages in PROC DOCUMENT output

  Hi,

  But the number of pages created originally might not be the same as the number of pages as when you do the replay, because you can alter the margins, for example, for one replay to be really, really big and then the number of pages might be different. As far as I know, you can't capture the number of pages directly. Although in the OLD days, before the {thispage} and {lastpage} functions, you had to output to a postscript file and then read the postscript file with a program to grab the number of pages. Not a pretty process.

  I think of the object as being "self-contained" and instead of printing the last "n" pages, I would look at some of the controls that let you use WHERE processing to select BY groups or by labels for example -- you could select the last BY group to replay. See the WHERE option for the REPLY statement with PROC DOCUMENT:

SAS(R) 9.4 Output Delivery System: User's Guide, Second Edition

cynthia

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