BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

Would like to know how to do this in Proc Report.
How to only display Grand Totals of certain columns and to hide some of those Grand Totals that are not needed?

Thanks a Ton!
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
A search of the SAS support website http://support.sas.com/ using either the website's SEARCH facility or using the Google advanced search argument below yielded matching DOC and technical paper (user community, SUGI, SGF) documents on this topic.

Google advanced search argument (site parameter must be in lowercase):
proc report grand totals site:sas.com


Scott Barry
SBBWorks, Inc.
venkatesh
Calcite | Level 5
Hi Lee.,

data grocery;
input Sector $ Manager $ Department $ Sales @@;
datalines;
se 1 np1 50 se 1 p1 100 se 1 np2 120 se 1 p2 80
se 2 np1 40 se 2 p1 300 se 2 np2 220 se 2 p2 70
nw 3 np1 60 nw 3 p1 600 nw 3 np2 420 nw 3 p2 30
nw 4 np1 45 nw 4 p1 250 nw 4 np2 230 nw 4 p2 73
nw 9 np1 45 nw 9 p1 205 nw 9 np2 420 nw 9 p2 76
sw 5 np1 53 sw 5 p1 130 sw 5 np2 120 sw 5 p2 50
sw 6 np1 40 sw 6 p1 350 sw 6 np2 225 sw 6 p2 80
ne 7 np1 90 ne 7 p1 190 ne 7 np2 420 ne 7 p2 86
ne 8 np1 200 ne 8 p1 300 ne 8 np2 420 ne 8 p2 125
;
proc report data=grocery nowd;
column manager department sales;
define manager / order width=8 'Sales Manager';
define sales / analysis sum format=dollar7.2 'Sales';
/* break after manager / dol summarize suppress skip; */
rbreak after /dol summarize;
run;

Thanks.....
Cynthia_sas
Diamond | Level 26
Hi:
Here are some other samples, which use SASHELP.SHOES and may or may not be what you want to do. One example "hides" totals for 2 columns and the other example uses NOPRINT and the hiding technique. Note that if missing is not set to display as space, then you will see '.' in the grand total line.

cynthia
[pre]

options missing = ' ';
proc report data=sashelp.shoes nowd;
title 'Blank Out Total for Inventory and Returns';
column region sales inventory returns both;
define region / group;
define sales / sum 'Sales';
define inventory / sum;
define returns / sum;
define both / computed 'Inventory minus Returns' f=dollar14.;
rbreak after / summarize;
compute both;
both = inventory.sum - returns.sum ;
endcomp;
compute after;
region = 'Grand Total';
inventory.sum = .;
returns.sum = .;
endcomp;
run;

options missing = ' ';
proc report data=sashelp.shoes nowd;
title 'Hide Inventory Column, but Use It';
column region sales inventory returns both;
define region / group;
define sales / sum 'Sales';
define inventory / sum noprint;
define returns / sum;
define both / computed 'Inventory minus Returns' f=dollar14.;
rbreak after / summarize;
compute both;
both = inventory.sum - returns.sum ;
endcomp;
compute after;
region = 'Grand Total';
inventory.sum = .;
returns.sum = .;
endcomp;
run;

[/pre]

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1278 views
  • 0 likes
  • 4 in conversation