Date: Wed, 20 May 1998 09:45:10 +0100
Reply-To: David Yeates <david.yeates@health-care-epidemiology.oxford.ac.uk>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: David Yeates <david.yeates@HEALTH-CARE-EPIDEMIOLOGY.OXFORD.AC.UK>
Subject: Re: cumulative sum
Content-Type: text/plain; charset="iso-8859-1"
Patrick,
The SAS code to create the cumulative sum of variable x could look like...
data <dataset>;
retain cum_x 0;
cum_x + x;
<other SAS code>
run;
Hope this helps
David
--
UHCE, Oxford University
mailto:david.yeates@uhce.ox.ac.uk
http://www.views-uk.demon.co.uk/
Ludger Hinners:
>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
>
|