BookmarkSubscribeRSS Feed
haroldkurt
Calcite | Level 5

I know there is not a 'linesleft' option when creating ODS PDF output.

However, I'm trying to solve a problem.

We are creating an ODS PDF output, but need to be able to check to see how many lines are left on the current page, to determine if I need to start a new page for the next phase of output.

To create report, using a lot of "ods pdf text" statements and Proc Reports.

Tried using macros and counting output lines and failed miserably.

Any ideas?

5 REPLIES 5
ballardw
Super User

Since there is no such thing as a "standard" page size and line "heights" change all over the map from changes in font or inclusion of graphic elements I suspect you will not find a "nice" solution to this.

 

I don't usually use PDF but with RTF output I will run the output once without the STARTPAGE=NO option and send all of the output to a document. Then examine the output for where I need to insert an ods rtf startpage =now; ods rtf startpage=no; statement pair that inserts a page break and then stops automatic page breaks until the next. I'm not sure off the top of my head what the PDF equivalent would be.

 

Of course most of my output I do this with seldom exceeds 15 or 20 pages.

haroldkurt
Calcite | Level 5
thank you. right now I'm simply trying to figure out a way to 'count' the lines I've output at any given time to make the decision to break page
Cynthia_sas
SAS Super FREQ

Hi:

  You are setting yourself nearly an impossible task. Consider this example of the SAME report of 19 obs, no titles, no footnotes and 1 extra line created with PROC REPORT. Note how the different fonts impact the amount of room "left" on the page. The amount of space left is a function of the font and font size being used, the cellspacing being used, the margins being used, whether page numbers are on or off.

diff_font_pdf.png 

 

Even with the same data and exact same report and ONLY changing the font, the amount of space available is different. Changing margins or other attributes would impact each report too. Honestly, I will typically run the report one time and figure out given my margins, style, font, etc how many obs will fit on the page and then I insert a manual page breaking variable for PROC REPORT and use that if I really, really need to control page breaks. Or else, I use ODS PDF STARTPAGE=NOW; between procedures as suggested.

 

cynthia

haroldkurt
Calcite | Level 5
thank you for the help. at this point, i'm not willing to accept impossible. there is a way, i just haven't found it
ballardw
Super User

@haroldkurt wrote:
thank you for the help. at this point, i'm not willing to accept impossible. there is a way, i just haven't found it

Many years ago I worked for an organization that prepared an annual report where we had to do something loosely similar. For one part of the report we were calculating things for every single table because we had to create raw printer codes, HTML and such were basically years in the future and printer drivers didn't really exist for the device we were producing tables and charts for.

So we had to know the size of the paper this would print on, the margins, top, bottom, left and right. Determine the number of lines of text, the amount of "cell padding space" and thickness of the lines between cells, top/bottom/left/right in typesetting units as well as the spaces between tables, text for titles and all that, and the vector graphics to draw simple line charts.

I was lucky in that by the time I worked there they had been developing and modifying the base code for nearly 10 years so we had guidelines on what to do when one of our text items didn't fit in the designed space that worked most of the time. But we still usually had a dozen or so trial and errors for every table that required modification.

 

 

Easier was the line-printer fixed-width font report where we placed about 10 tables on a single sheet of paper using PUT statements with column and line specifications with underline code.

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