The SAS Output Delivery System and reporting techniques

When group in PROC REPORT spans 2 pages for ODS PDF...

Reply
Contributor
Posts: 29

When group in PROC REPORT spans 2 pages for ODS PDF...

[ Edited ]

When one group or more spans more than a page in PDF output produced by PROC REPORT and ODS PDF, what commands would be necessary to make the the group value re-display on the next page.

 

For example, lets look at STEP 5 in the PDF on SAS website: http://www2.sas.com/proceedings/forum2008/079-2008.pdf.

 

Supposedly those first two lines are at the bottom of page 1 of the PDF:

County  Zip                            Monthly
Name    Code   Variety          Sales
-------------------------------------
...
Adams   52199  Merlot            233.03
                          Chardonnay   185.22
                          Zinfandel        95.84
              52200  Merlot           385.51
                          Chardonnay  246.00

 

 

By default, page 2 would look like this:

 

County  Zip                            Monthly
Name    Code   Variety          Sales
-------------------------------------
                                                 76.24
                          Zinfandel      151.10
Scott      52388  Merlot          122.89
                          Chardonnay   78.22
                          Zinfandel        15.40
              52423  Merlot           186.00
                                                 55.30
                          Chardonnay  156.61
                          Zinfandel         35.50

 

But what if I want every page to redisplay whatever group values from previous page if it spans more than one and even wedge an empty line between each county/zip/variety combo like this below?

 

Page 1:

County  Zip                            Monthly
Name    Code   Variety          Sales
-------------------------------------
...
Adams   52199  Merlot            233.03
                          Chardonnay   185.22
                          Zinfandel        95.84


              52200  Merlot           385.51
                          Chardonnay  246.00

 

Page 2:

County  Zip                            Monthly
Name    Code   Variety          Sales
-------------------------------------
Adams   52200 Chardonnay    76.24
                          Zinfandel      151.10


Scott      52388  Merlot          122.89
                          Chardonnay   78.22
                          Zinfandel        15.40


              52423  Merlot           186.00
                                                 55.30


                          Chardonnay  156.61
                          Zinfandel         35.50

Frequent Contributor
Posts: 92

Re: When group in PROC REPORT spans 2 pages for ODS PDF...

You can use the SPANROWS option to repeat the group value across pages.  

 

options nodate;

ODS PDF FILE='/folders/myfolders/PROC REPORT/spanrows_example.pdf';

proc report data=sashelp.cars spanrows;
  col make model type origin;
  define make / group;
run;

ODS PDF CLOSE;

SPANROWS in PROC REPORT repeats group variable on next pageSPANROWS in PROC REPORT repeats group variable on next page

 

See pages 3 and 4 of Beyond the Basics: Advanced REPORT Procedure Tips and Tricks Updated for SAS® 9.2  for more details.

Ask a Question
Discussion stats
  • 1 reply
  • 135 views
  • 0 likes
  • 2 in conversation