The SAS Output Delivery System and reporting techniques

ODS PDF & 'linesleft'

Reply
New Contributor
Posts: 3

ODS PDF & 'linesleft'

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?

Super User
Posts: 11,765

Re: ODS PDF & 'linesleft'

Posted in reply to haroldkurt

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.

New Contributor
Posts: 3

Re: ODS PDF & 'linesleft'

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
SAS Super FREQ
Posts: 8,951

Re: ODS PDF & 'linesleft'

Posted in reply to haroldkurt

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

New Contributor
Posts: 3

Re: ODS PDF & 'linesleft'

Posted in reply to Cynthia_sas
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
Super User
Posts: 11,765

Re: ODS PDF & 'linesleft'

Posted in reply to haroldkurt

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.

Ask a Question
Discussion stats
  • 5 replies
  • 231 views
  • 0 likes
  • 3 in conversation