BookmarkSubscribeRSS Feed
jmhill
Calcite | Level 5

I need to create a "Weekday Total" that sums up the Weekdays (Sun- Sat) at the end(bottom) of the report output. I know I need to add a compute and possibly an rbreak, but I am not sure how to do this. Thanks in advance!

 

PROC REPORT NOWD DATA=WORK.WEEKLY_TOTALS BOX SPLIT='\'
STYLE (HEADER)={JUST=center FOREGROUND=white BORDERCOLOR=BLACK BACKGROUND=#201F73 font_weight=bold}
STYLE (REPORT)={CELLSPACING=5 BORDERCOLOR=BLACK};

TITLE1 "QA Sendbacks - Weekday Totals";
/*TITLE2 'UM PROJECTS';*/

COLUMNS LOB CLIENT SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY WEEKLY_TOTAL;

define LOB / DISPLAY style(column)=[cellwidth=0.70in];
DEFINE CLIENT / DISPLAY "CLIENT" style(column)=[cellwidth=2.0in];
define SUNDAY / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define MONDAY / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define TUESDAY/ DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define WEDNESDAY / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define THURSDAY / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define FRIDAY / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define SATURDAY / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];
define WEEKLY_TOTAL / DISPLAY FORMAT=COMMA9. style(column)=[cellwidth=0.65in];


compute LOB;
count+1;
if mod(count,2) then do;
call define(_row_, "style", "style=[background=grayf0]");
end;
endcomp;
run;
quit;

1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
Well, you can try
RBREAK AFTER / SUMMARIZE;

and see whether that gives you the grand total you want. Since you didn't post data, nobody can run your program without making some fake data that might be wrong. You have everything as a usage of DISPLAY, which could imply that it is already summarized down to the LOB and CLIENT level or could imply that you have multiple rows per LOB and CLIENT. Hard to say.

Also, since WEEKLY_TOTALS is a usage of display, that implies you've already calculated that value. The ability to label the grand total line from the RBREAK statement with the string "Weekday Totals" will depend on whether LOB is character or numeric and whether the size of LOB (if character) is big enough to hold the string "Weekday Totals".

You show the use of ODS style overrides, but you do NOT show which destination (HTML, RTF, PDF) you want to create. You show the BOX option, which is incompatible with ODS and so that part of your code is confusing.

This would be an easier question to answer if you had posted some sample data or worked up an example using SASHELP data. And, it might have been faster for you to get an answer if you had searched in the forum for previous PROC REPORT questions relating to RBREAK or COMPUTE.

I'd recommend starting with the RBREAK statement and going from there.

Cynthia

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
  • 596 views
  • 0 likes
  • 2 in conversation