Date: Wed, 17 Nov 2004 20:41:25 -0800
Reply-To: Jason Zhang <qiyuzhang2@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jason Zhang <qiyuzhang2@YAHOO.COM>
Subject: lag1() question
Content-Type: text/plain; charset=us-ascii
Hi,
I want to generate a value for a variable, say t. But
tĄ¯s value depends on previous observationĄ¯s t value.
I used the code:
T=lag1(t)*0.8;
It doesnĄ¯t work. The following is an example of what
I want to do:
data one;
input x;
cards;
1
2
3
4
5
6
;
run;
data two;
set one;
if _n_=1 then t=1; else
t=lag1(t)*0.8;
run;
what I expected for tĄ¯s values are:
1
0.8
0.64
Ą
Can anyone help me with this? Thanks a lot!!!
Jason
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com