The SAS Output Delivery System and reporting techniques

Find number of observations on Page 1 of PROC Report

Reply
Occasional Contributor
Posts: 5

Find number of observations on Page 1 of PROC Report

Hi Team,

Is there a means by which i can find out number of observations that would fit in page 1 of PROC REPORT? The observations vary as the size of text changes. I want to be in a position to determine number of observations that would be fit in Page 1 of a PROC REPORT statement.

Thanks in advance,

Vimal

SAS Super FREQ
Posts: 8,720

Re: Find number of observations on Page 1 of PROC Report

Hi:

  The number of observations that will fit on page 1 will depend on a number of things. Your destination. For example: the LISTING window is controlled by LS= and PS= system options. So in that destination, you know exactly how many report rows will fit on 1 page, based on the value of the PS= option. But other destinations, like ODS HTML, ODS PDF or ODS RTF do not use the LS= and PS= options. In addition, destinations like ODS HTML that create HTML files do NOT really adhere to the concept of "pages" since an entire report (whether there are 2 report rows or 2000 report rows) is considered to be just 1 HTML web "page".

  The ODS RTF and ODS PDF destinations are impacted by font size. For example, you can get more rows on a "page" of output when your font size is 6 pt than when your font size is 16 pt or 20 pt. In addition, other style changes (like changing cellpadding can have an impact on the HTML, RTF and PDF destinations. For example, when I run this code, I see many more observations on the 2nd report than on the first report in the "paged" destinations.

Cynthia

**1 use all defaults;

ods html file='c:\temp\test_def.html';

ods pdf file='c:\temp\test_def.pdf';

ods rtf file='c:\temp\test_def.rtf';
    

  proc report data=sashelp.shoes nowd;

    title '1) With default font size';

  run;

ods _all_ close;
    

**2 change font size to 6pt and cellpadding to 0;

ods html file='c:\temp\test_6.html';

ods pdf file='c:\temp\test_6.pdf';

ods rtf file='c:\temp\test_6.rtf';
     

  proc report data=sashelp.shoes nowd

       style(report)={cellpadding=2px}

       style(header)={fontsize=6pt fontweight=bold}

       style(column)={fontsize=6pt};

    title '2) Change font size to 6pt and cellpadding to 0';

  run;

ods _all_ close;

Occasional Contributor
Posts: 5

Re: Find number of observations on Page 1 of PROC Report

Thank you for your elaboration Cynthia. For solution to my problem, i was looking at means to find number of rows on Page 1. Any option to just print page 1 of PROC REPORT?

Grand Advisor
Posts: 10,211

Re: Find number of observations on Page 1 of PROC Report

When I have had issues related to this I discussed the appearance with the end users of the report. So we could set margins, font sizes, value formats, number of title lines, number of  footnote lines and such.

Then generated a dummy report with the specified settings and verified with the user that would work. Then I determined the maximum number of lines that would fit on a page.

After that I worried about manipulating any data to get the "pretty" results to fit with the space allotted.

Unless you are going to go to old school line-printer output then printing an example is about the best to make sure everyone is happy with the result.

And of course HTML doesn't even have the concept of "page" in this context.

SAS Super FREQ
Posts: 8,720

Re: Find number of observations on Page 1 of PROC Report

Hi:

  The only way to "limit" PROC REPORT is on the OBS= option. So if you can approximate, as BallardW suggested on the font size, title, cosmetics, then for a sample, you should be able to do something like this:

ods html file='c:\temp\test_def.html';

ods pdf file='c:\temp\test_def.pdf';

ods rtf file='c:\temp\test_def.rtf';
    

  proc report data=sashelp.shoes(obs=30) nowd;

    title '1) With default font size';

  run;

ods _all_ close;

OR, just open the output file in Acrobat Reader or in Microsoft Word and use the PRINT PREVIEW feature of the rendering software to only "print" you the first page.

cynthia

Ask a Question
Discussion stats
  • 4 replies
  • 499 views
  • 0 likes
  • 3 in conversation