Date: Fri, 22 May 2009 17:35:29 -0400
Reply-To: Randy <randistan69@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Randy <randistan69@HOTMAIL.COM>
Subject: Lead Function
Dear All:
Is there a lead function in SAS 9.1. I could not find it in Documentation.
Perhaps you guys can help me with my question. The data set is as follows:
VarA Time
A 11:31
A 11:32
A 11:33
A 11:35
B 11:36
A 11:40
A 11:51
A 11:52
B 11:53
B 11:54
B 11:55
A 11:57
The dataset that I want with the lead time with one condition. Two lags
before a B takes the time of the last B in the group. So in the case of the
first B the var Lead_time (third row) takes a value of 11:36 (the value of
the last B in that group). Similarly, the lead_time value in row 7 takes
the value of the last B value (11:55) in the forward group
VarA Time Lead_time
A 11:31 11:32
A 11:32 11:33
A 11:33 11:36
A 11:35 11:36
B 11:36 11:40
A 11:40 11:51
A 11:51 11:55
A 11:52 11:53
B 11:53 11:54
B 11:54 11:55
B 11:55 11:57
A 11:57 .
Can you please help.