BookmarkSubscribeRSS Feed
VimalKurup
Calcite | Level 5

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

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

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;

VimalKurup
Calcite | Level 5

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?

ballardw
Super User

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.

Cynthia_sas
SAS Super FREQ

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

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