|
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
|