Date: Wed, 27 Nov 2002 15:41:21 -0000
Reply-To: JamesCouston@IF.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jamie C <JamesCouston@IF.COM>
Subject: Re: Proc report : summing variables in an across grouping
Content-Type: text/plain; charset=iso-8859-1
Hmm,
This won't work in the context I have, I'll post some code,
*----------------------------------------------------------------------;
proc report data = inputdataset nofs;
column pa_class app_status product_type,
first_contact, volume;
define pa_class / "Intermediary Type" group;
define app_status / "App. Stage" group order=internal;
define product_type / "" across format=$product.;
define first_contact / "" across;
define volume / "Vol." analysis format=comma14.;
*--- summary lines;
break after pa_class / suppress;
run;
*----------------------------------------------------------------------;
This gives me output of the form,
product_type
product_type
pa_class app_status first_contact first_contact
first_contact first_contact
XXXXXXX XXXXXXXXX volume volume volume
volume
XXXXXXXXX volume volume volume
volume
And what I would like is a total inserted ------------* inbetween the
product_type across groups summing the two previous volumes within the
first_contact across group. How do I construct the column statement? And the
define and compute statements? I'm thinking that I might have to have
duplicate first_contact variables within the input dataset - this would
allow me to use entirely seperate across groupings and a computed variable
after each. It doesn't seem like a very elegant solution to me though!
Cheers,
Jamie.
-----Original Message-----
From: Nevseta, Floyd G [mailto:Floyd.G.Nevseta@bankofamerica.com]
Sent: 27 November 2002 15:26
To: 'Jamie C'; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Proc report : summing variables in an across grouping
You can reference a column in PROC REPORT using the _cn_ notation, where n
is the column number. So, in your example below, the compute block for
cat1total should look something like this:
compute cat1total;
cat1total = _c1_.sum + _c2_.sum;
endcomp;
If your totals don't add up correctly at first, check to see if you have the
correct column numbers. The online doc says that report items that are
defined as noprint or nozero are included in the column count, even though
those columns may not display in the actual report.
Regards,
Floyd
-----Original Message-----
From: Jamie C [mailto:jamescouston@IF.COM]
Sent: Wednesday, November 27, 2002 6:55 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Proc report : summing variables in an across grouping
Hi,
I have a problem with proc report that you may be able to help me with - I
have three variables, two nested across groups then a third analysis one
like this,
across, across, analysis
e.g.
cat1 cat2
sub1 sub2 sub1 sub2
123 123 123 123
(NB. the '123's are just for demonstration, they represent the analysis
variable content)
Now, what I would like to do is have a computed variable that will sum the
analysis vars after the second across group has completed,
e.g.
cat1 cat1total cat2 cat2total
sub1 sub2 sub1 sub2
123 123 246 123 123 246
I'm at a loss to how I should approach this purely within the proc report,
I really don't want to have to summarise the data myself within the input
datastep as these across groups are within by groups. If I summarise the
data myself, I might as well go the whole way and then just proc print the
output out!
Thanks in advance,
Jamie.
Intelligent Finance is a division of Halifax plc, Registered in England No. 2367076, Registered Office: Trinity Road, Halifax, West Yorkshire HX1 2RG.