BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tiaan
Calcite | Level 5

Hi,

 

Can ODS document or any other SAS method determine the page count that a document will have after its generation (before actually creating the document)?

 

I want to generate a RTF document that cannot have more than 1000 pages. If the data will lead to more than 1000 pages I want a preemtive warning as currently I need to open the document and check every time the data updates.

 

I have all the related information at hand in a template or options (margins, cellpadding, page size etc.) and the code looks something like this:

 

Information that influences document:

OPTIONS FONT='courier new' normal 9 NODATE NONUMBER ORIENTATION=landscape;
OPTIONS PAPERSIZE=A4 TOPMARGIN = 1in BOTTOMMARGIN = 1in LEFTMARGIN = 1in RIGHTMARGIN = 1in;

PROC TEMPLATE;
  DEFINE STYLE styles.mystyle;
  PARENT=styles.printer;
  style parskip / fontsize = 5pt;
  REPLACE FONTS /
    'TitleFont'           = ('courier new', 9pt)
    'TitleFont2'          = ('courier new', 9pt)
    'StrongFont'          = ('courier new', 9pt)
    'EmphasisFont'        = ('courier new', 9pt)
    'HeadingEmphasisFont' = ('courier new', 9pt)
    'HeadingFont'         = ('courier new', 9pt)
    'DocFont'             = ('courier new', 9pt)
    'FootFont'            = ('courier new', 9pt)
    'FixedEmphasisFont'   = ('courier new', 9pt)
    'FixedStrongFont'     = ('courier new', 9pt)
    'FixedHeadingFont'    = ('courier new', 9pt)
    'BatchFixedFont'      = ('courier new', 9pt)
    'FixedFont'           = ('courier new', 9pt);
  REPLACE TABLE FROM OUTPUT /
    frame = box
    rules = all
    cellpadding = 1pt
    cellspacing = 0;
  CLASS SYSTEMTITLE /
    protectspecialchars=OFF
    asis=ON;
  CLASS SYSTEMFOOTER /
    font=Fonts('footFont')
    protectspecialchars=OFF
    asis=ON;
  CLASS HEADER /
    protectspecialchars=off;
  CLASS DATA /
    protectspecialchars=off;
  CLASS ROWHEADER /
    protectspecialchars=off;
  CLASS USERTEXT /
    protectspecialchars=off;
  CLASS BYLINE /
    protectspecialchars=off;
  STYLE graphfonts from graphfonts /
    'GraphDataFont'     = ('courier new', 9pt)
    'GraphUnicodeFont'  = ('courier new', 9pt)
    'GraphValueFont'    = ('courier new', 9pt)
    'GraphLabel2Font'   = ('courier new', 9pt)
    'GraphLabelFont'    = ('courier new', 9pt)
    'GraphFootnoteFont' = ('courier new', 9pt)
    'GraphTitleFont'    = ('courier new', 9pt)
    'GraphTitle1Font'   = ('courier new', 9pt)
    'GraphAnnoFont'     = ('courier new', 9pt);
  END;
RUN;

The document generation code:

 

ODS RTF FILE = "C:\mydoc.rtf" STYLE=styles.mystyle HEADERY=1 FOOTERY=800 NOTOC_DATA NOCONTENTS;
  ;
  ;
ODS escapechar='^';
ODS RESULTS OFF;
ODS RTF TEXT = "Some Information";


...proc report code here...


ODS RTF CLOSE;
RUN;

What I am wondering is if I exchange the ODS RTF with ODS DOCUMENT can the pages that will be used be determined?

 

Playing around with ODS DOCUMENT AND PROC DOCUMENT I could not find any such information yet.

 

 

Thank you for your help,
Tiaan

1 ACCEPTED SOLUTION

Accepted Solutions
Tim_SAS
Barite | Level 11
Sorry. ODS can't determine the page count like this.

View solution in original post

2 REPLIES 2
Tim_SAS
Barite | Level 11
Sorry. ODS can't determine the page count like this.
Tiaan
Calcite | Level 5

Hi Tim,

 

Ok, thank you for the confirmation anyway.

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