| Date: | Wed, 20 May 1998 09:48:24 +0200 |
| Reply-To: | martin trollope <martint@HOLLARD.CO.ZA> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | martin trollope <martint@HOLLARD.CO.ZA> |
| Subject: | Re: cumulative sum |
|
| Content-Type: | text/plain; charset="us-ascii" |
Data New;
retain cum_x 0;
set old;
cum_x = cum_x + x;
run;
----------
From: Ludger Hinners[SMTP:lhinner@GWDG.DE]
Reply To: Ludger Hinners
Sent: 20 May 1998 09:11
To: SAS-L@AKH-WIEN.AC.AT
Subject: cumulative sum
Has anybody tried (and succeeded...), say for a variable x with a series
of observations, to create a new variable cum_x containing the
cumulative sum of x (current value plus all previous values)??? i.e, if
x has the values 2, 0, 5, 3 than cum_x would have the values 2, 2, 7,
10. Any ideas what a relevant sascode could look like?
Many thanks
Patrick Verissimo
pveriss@gwdg.de
|