Hello. I have the below Proc Report I have run, with a By group. When I output to ODS PDF I would like each By group to be on its own page as opposed to 1 report which runs over the page. Is it possible to do this? The reason all the variables are DISPLAY is because of how I had to set this up. Basically this is the final output from 4 different Proc Reports stacked on top of each other. Thank you.
ODS PDF STARTPAGE=NOW;
ODS LAYOUT gridded rows=1 columns=1 STYLE={backgroundcolor=white};
ODS REGION ;
ods proclabel "Outflow Summary";
PROC REPORT DATA=WORK.OUTFLOWS_TOTALA style(HEADER)=[background=blue foreground=white font_weight=bold] CONTENTS='';
BY Metric NOTSORTED;
COLUMN ('Total FM Outflow Summary' Metric Lvl2_FF_Region SOURCE MTD PrevDay PrevWk PrevMo PrevMo2 PrevMo3);
DEFINE Metric / group style=[font_weight=bold];
DEFINE Lvl2_FF_Region / group;
DEFINE Source / DISPLAY;
DEFINE MTD / DISPLAY FORMAT=COMMA8.;
DEFINE PrevDay / DISPLAY "&PREVDAY" FORMAT=COMMA8.;
DEFINE PrevWk / DISPLAY "&PREVWKE" FORMAT=COMMA8.;
DEFINE PrevMo / DISPLAY "&PREVMOE" FORMAT=COMMA8.;
DEFINE PrevMo2 / DISPLAY "&PREVMOE2" FORMAT=COMMA8.;
DEFINE PrevMo3 / DISPLAY "&PREVMOE3" FORMAT=COMMA8.;
COMPUTE Source;
if SOURCE='' then call define (_row_,'style','style=[background=lightgrey font_weight=bold]');
ENDCOMP;
BREAK BEFORE Metric / CONTENTS='' page;
RUN;
ODS LAYOUT END;
ODS PDF CLOSE;
Can't read as all upper case and no indentation. From your initial text I would suggest:
... by <variable>; break after <variable> / page;
However why have the data in both by group and in a column, doesn't make much sense. If you need it in the body then put it there, drop the by bit and do a break after <variable> / page and have a subheading or compute block display the by group.
... break after <variable> / page; compute before; line <variable>; endcomp;
Can't read as all upper case and no indentation. From your initial text I would suggest:
... by <variable>; break after <variable> / page;
However why have the data in both by group and in a column, doesn't make much sense. If you need it in the body then put it there, drop the by bit and do a break after <variable> / page and have a subheading or compute block display the by group.
... break after <variable> / page; compute before; line <variable>; endcomp;
Thank you I am new to using Proc Report so I appreciate your insights.
One thing to add, by subheading I mean:
... by <variable>; title3 "This is for data #byval1"; break after <variable> / page;
The title can have by values in them, so you can use the column as data, and pass it to a title statement.
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.
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.