Problem Note 7887: PROC REPORT does not repeat values of GROUP/ORDER variables when groups
break across pages
In the Listing destination, when a variable defined as GROUP or ORDER breaks across a page, its value is repeated at the top of the subsequent page. This does not occur in the ODS PRINTER (PCL, PDF, PS) or the ODS RTF destinations.
Due to vertical measurement issues, this feature will not be added to the ODS RTF destination. This feature is available in SAS 9.2 for the ODS PRINTER (PCL, PDF, PS) destinations using the SPANROWS option on the PROC REPORT statement, which is documented
here.
For a way to use the new SPANROWS option in PROC REPORT with the RTF TAGSET in SAS 9.2, see Sample 35544.
A workaround for ODS RTF in all SAS versions is to use code similar to that in the Full Code tab to create a dummy variable upon which a page break is forced in PROC REPORT. This value will be displayed at the top of every page. This workaround code will also be necessary in SAS 9.1.3 and earlier when creating ODS PDF, PCL, or PS output.
Operating System and Release Information
SAS System | Base SAS | Microsoft Windows 2000 Server | 8 TS M0 | 9.2 |
Microsoft Windows 95/98 | 8 TS M0 | |
Microsoft Windows NT Workstation | 8 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 8 TS M0 | 9.2 |
Microsoft Windows 2000 Professional | 8 TS M0 | 9.2 |
Microsoft Windows 2000 Advanced Server | 8 TS M0 | 9.2 |
Solaris | 8 TS M0 | 9.2 |
OpenVMS VAX | 8 TS M0 | 9.2 |
64-bit Enabled Solaris | 8 TS M0 | 9.2 |
z/OS | 8 TS M0 | 9.2 |
IRIX | 8 TS M0 | 9.2 |
OS/2 | 8 TS M0 | 9.2 |
Tru64 UNIX | 8 TS M0 | 9.2 |
64-bit Enabled AIX | 8 TS M0 | |
OpenVMS Alpha | 8 TS M0 | |
CMS | 8 TS M0 | |
64-bit Enabled HP-UX | 8 TS M0 | 9.2 |
HP-UX | 8 TS M0 | 9.2 |
ABI+ for Intel Architecture | 8 TS M0 | 9.2 |
AIX | 8 TS M0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
This code creates a dummy variable PAGEIT upon which a page break is forced in PROC REPORT. The value for TYPE will be displayed at the top of every page, even when its value spans multiple pages. This logic is necessary in ODS RTF for all SAS versions, and in SAS 9.1.3 for the ODS PDF, PCL, and PS destinations.
/* Create a dummy data set. */
data new;
do i=1 to 100;
if i < 72 then type='first';
else type='last';
newval='newval'||left(i);
output;
end;
run;
/* Sort the data set BY the GROUP/ORDER variable(s)
in the PROC REPORT step. */
proc sort data=new;
by type;
run;
/* PAGEIT increments once based on every 25 observations in FLAG
grouping. FLAG is not needed in PROC REPORT, but is necessary
in resetting PAGEIT. FLAG value of 25 is picked in this instance
in order to paginate after every 25 detail rows - this number
can vary based on font size, margin settings, orientation, etc. */
data reset;
set new;
by type;
if _n_ eq 1 then flag=0;
else flag+1;
if flag >=25 then do;
pageit+1;
flag=0;
end;
run;
ods pdf file='mypdf.pdf';
ods rtf file='myrtf.rtf';
proc report data=new nowd;
title 'No repetition of TYPE when VALUE breaks across pages';
column type i newval;
define type / order order=internal;
define i / display;
run;
/* PAGEIT is set to NOPRINT as it will only be used for pagination. */
proc report data=reset nowd ;
title 'Workaround using dummy var - PAGEIT to force pagebreaks and
repetition of TYPE values';
column pageit type i newval;
define pageit / order order=internal noprint;
define type / order order=internal ;
define i / display;
break after pageit / page;
run;
ods _all_ close;
PROC REPORT does not repeat values of GROUP/ORDER variables when groups
break across pages.
Type: | Problem Note |
Priority: | medium |
Topic: | SAS Reference ==> Procedures ==> REPORT
|
Date Modified: | 2009-09-03 10:39:50 |
Date Created: | 2002-06-28 15:33:20 |