BookmarkSubscribeRSS Feed
BigPete
Obsidian | Level 7

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

1 REPLY 1
SuzanneDorinski
Lapis Lazuli | Level 10

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.

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
  • 1 reply
  • 700 views
  • 0 likes
  • 2 in conversation