Date: Fri, 15 Oct 1999 10:59:58 -0400
Reply-To: "Stein, Christopher D" <christopher_d_stein@GROTON.PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Stein, Christopher D" <christopher_d_stein@GROTON.PFIZER.COM>
Subject: Re: What's wrong with the lag function?
Content-Type: text/plain; charset="iso-8859-1"
Not a specific answer to your question, but..... In my experience, problems
arise when the lag function is applied within a conditional expression. The
best best is to assign the lagged value unconditionally and use it
SAS and Statistical Software Support Services (S5)
CBSU Customer Center
Pfizer Central Research
Groton, CT 06370
From: Huang, Ya [mailto:Y.Huang@ORGANONINC.COM]
Sent: Friday, October 15, 1999 10:27 AM
Subject: What's wrong with the lag function?
This question seems to have been asked by somebody long time ago, I don't
remember the answer, so forgive me to ask it again.
Can somebody explain to me why I have to use a intermediate variable
to keep the lag value and then I can use it to assign to other variable?
INPUT A B C;
1 2 1
3 4 1
5 6 0
7 8 1
data yy; set xx;
if c=0 then a=lag(b); /** not working ***/
data zz; set xx;
if c=0 then a=d; /** this way works **/
Syntaxly no error in both of the data steps, logically I really don't see
the difference between these two data steps, so what is really going on?