sasproc-report

Is it possible to limit the numbers of observations per page for proc report


I am just wondering if there are any options can be used to limit the number of observations printed per page in Proc Report procedure?

Thank you


Solution

  • This depends in part on the destination.

    PROC REPORT in page-sensitive destinations, like ODS LISTING or ODS PDF, can be convinced to limit observations a few ways.

    ODS LISTING: OPTIONS PS=[#] will set the page size. PS option on PROC REPORT statement also does this. See PROC REPORT statement for more.

    ODS PDF, ODS RTF, other page-sensitive destinations: Create a page variable that stores which page an observation falls on.

    ods pdf;
    
    data cars;
      set sashelp.cars;
      if mod(_n_,20)=0 then page_num+1;
    run;
    
    proc report data=cars;
      columns make model page_num;
      define page_num/ order noprint;
      break after page_num/page;
    run;
    ods pdf close;