LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 17 Apr 2007 11:19:16 -0700
Reply-To:   shiling99@YAHOO.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Shiling Zhang <shiling99@YAHOO.COM>
Organization:   http://groups.google.com
Subject:   Re: how to obtain a column with compouned previous values
Comments:   To: sas-l@uga.edu
In-Reply-To:   <1176833515.495192.135490@q75g2000hsh.googlegroups.com>
Content-Type:   text/plain; charset="iso-8859-1"

On Apr 17, 2:11 pm, PBilin <pbi...@gmail.com> wrote: > hello, > > I was wondering if anybody knows how to solve the following problem. > For a time series date of the format: > date obs_number value_x > 01012000 1 1 > 01022000 1 1.2 > 01032000 1 12 > 01042000 1 5 > 01052000 1 6 > 01012000 2 42 > 01022000 2 1.422 > 01032000 2 15232 > 01042000 2 65 > 01052000 2 63 > > I would like to obtain a column which would be the compounded value of > the previous columns: > > date obs_number value_x compounded > 01012000 1 1 1 > 01022000 1 1.2 1*1.2 > 01032000 1 12 1*1.2*12 > 01042000 1 5 1*1.2*12*5 > 01052000 1 6 1*1.2*12*5*6 > 01012000 2 42 42 > 01022000 2 1.422 42*1.422 > 01032000 2 15232 42*1.422*15232 > 01042000 2 65 ... > 01052000 2 63 > > I would appreciate any help with this respect!!! > > Paul

Do something like,

data <dsnout>; set <dnsin>; by obs_number; retain compd_vx; if first.obs_number then compd_vx=value_x; else compd_vx=compd_vx*value_x; run;

HTH


Back to: Top of message | Previous page | Main SAS-L page