BookmarkSubscribeRSS Feed
gfarkas
Calcite | Level 5

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!

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

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

gfarkas
Calcite | Level 5

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?

Cynthia_sas
SAS Super FREQ

  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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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