BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BLarson
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
BLarson
Obsidian | Level 7

Thank you I am new to using Proc Report so I appreciate your insights. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

BLarson
Obsidian | Level 7
Fantastic, thank you again. Greatly appreciated!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 7419 views
  • 1 like
  • 2 in conversation