I am reporting a large listing of values for subgroups of my data. I have the data in the form I currently want and just have a cosmetic change to make. I am trying to find a way to print the value of the subgroup on the first line of each page but empty for the rest of the values.
I have tried doing this multiple ways using an the ID
option in define
, using a compute after
block, compute after _page_
, a pagination column and by using a by
statement but I can't maintain the structure of my data with these methods.
Here is some example data and basic proc report:
/* basic data */
data test;
input ID $ variable1 $ variable2 $;
datalines;
A Lemon Yellow
A Orange Red
A Lemon Blue
A Apple Green
A Lemon Yellow
A Orange Red
A Lemon Blue
A Apple Green
A Lemon Yellow
A Orange Pink
A Lemon Blue
A Apple Red
B Lemon Yellow
B Orange Red
B Lemon Blue
B Apple Green
B Lemon Yellow
B Orange Red
B Lemon Blue
B Apple Green
B Lemon Yellow
B Orange Pink
B Lemon Blue
B Apple Red
;
run;
/* output several times to cover multiple pages */
data test2;
set test;
if id = "A" then do;
output;
output;
output;
end;
output;
run;
/* proc report */
ods pdf;
proc report data = test2 nocenter nowd ;
define ID / order id ;
define variable1 / display;
define variable2 /display;
compute after ID;
line '';
endcomp;
run;
ods pdf close;
So in this example the values for A and B run over multiple pages. I want A and B to appear on their first observation and the first observation on a new page.
Any help is as always appreciated.