Help using Base SAS procedures

Proc Report: How to only display Grand Totals of certain columns?

Reply
N/A
Posts: 0

Proc Report: How to only display Grand Totals of certain columns?

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!
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc Report: How to only display Grand Totals of certain columns?

Posted in reply to deleted_user
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.
Contributor
Posts: 61

Re: Proc Report: How to only display Grand Totals of certain columns?

Posted in reply to deleted_user
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.....
SAS Super FREQ
Posts: 8,864

Re: Proc Report: How to only display Grand Totals of certain columns?

Posted in reply to deleted_user
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]
Ask a Question
Discussion stats
  • 3 replies
  • 159 views
  • 0 likes
  • 4 in conversation