Date: Mon, 8 Jan 2007 16:31:24 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Rolling totals in Proc Report
In-Reply-To: <1168271983.578019.117760@s80g2000cwa.googlegroups.com>
Content-Type: text/plain; format=flowed
Do you want it solely performed inside of the proc report or would a
preprocessing step be okay.
If it is the former your are stuck with doing something kind of wierd inside
of a compute block as proc report wasnt designed for something like this.
If it is the later the code become simplier as the data step before will
handle the aggregationand all you need to do with the proc report code is
simply spit it out.
Toby Dunn
To sensible men, every day is a day of reckoning. ~John W. Gardner
The important thing is this: To be able at any moment to sacrifice that
which we are for what we could become. ~Charles DuBois
Don't get your knickers in a knot. Nothing is solved and it just makes you
walk funny. ~Kathryn Carpenter
From: auto208611@HUSHMAIL.COM
Reply-To: auto208611@HUSHMAIL.COM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Rolling totals in Proc Report
Date: Mon, 8 Jan 2007 07:59:43 -0800
David,
You eluded that Howard pointed to the use of compute block, but I don't
see anything in this topic thread that indicates Howard has responded
with any suggestions.
Regardless, could someone show an example of how this could be done in
Proc Report within a compute block.
Thanks.
David L Cassell wrote:
> auto208611@HUSHMAIL.COM wrote back:
> >
> >Is it possible to create rolling totals as illustrated in the following
> >lines using
> >Proc Report ?
> >
> >Rolling Totals is the sum of the column labeled as 'OthYears(s)' after
> >each successive
> >'First Year'.
> >
> >So for instance, the rolling total after First Year = 1998 for 1998
> >only is 13689, the
> >rolling total after First Year = 1999 is 146666 (=5248+141418) and
> >after First Year = 2000
> >is 396090 (= 3572+48260+344258).
> >
> >
> >1) Total For 1998 Only 13,689
> >
> >2) Total For 1998 & 1998 146,666
> >
> >3) Total For 1998, 1999 & 2000 396,090
> >
> >
> > First Year OthYear(s) Counts
> > 1998 1998 13,689
> > 1999 5,248
> > 2000 3,572
> > 2001 2,636
> > 2002 1,913
> > 2003 1,678
> > 2004 1,410
> > 2005 1,360
> > 2006 1,238
> > Total For 1998 Only 13,689 <------
> > Total Across '98 32,744
> >
> > 1999 1999 141,418
> > 2000 48,260
> > 2001 30,944
> > 2002 22,468
> > 2003 18,410
> > 2004 16,308
> > 2005 15,216
> > 2006 13,764
> > Total For '98 & '99 146,666 <------
> > Total Across '99 306,788
> >
> > 2000 2000 344,258
> > 2001 98,350
> > 2002 65,693
> > 2003 51,257
> > 2004 45,319
> > 2005 42,126
> > 2006 37,754
> > Total For '98, '99 & 2000 396,090 <------
> > Total Across 2000 684,757
>
> It looks like the easiest approach would be to 'pre-process'
> your data into a table that already has the rolling totals
> available, and then use compute blocks to insert those
> data points into the tables as you need them. I think that
> Howard has pointed most of this out already.
>
> HTH,
> David
> --
> David L. Cassell
> mathematical statistician
> Design Pathways
> 3115 NW Norwood Pl.
> Corvallis OR 97330
>
> _________________________________________________________________
> Get live scores and news about your team: Add the Live.com Football Page
> www.live.com/?addtemplate=football&icid=T001MSN30A0701
_________________________________________________________________
Communicate instantly! Use your Hotmail address to sign into Windows Live
Messenger now. http://get.live.com/messenger/overview
|