Date: Fri, 29 May 2009 06:29:15 -0700
Reply-To: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject: Re: need a sas function analagous to LAG function
In-Reply-To: <200905291249.n4TAlR2N003998@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
On May 29, 2009, at 5:49 am, Randall Powers wrote:
> Hello All,
>
> I am familiar with the LAG function. It allows you to use a value of a
> variable from the previous observation in hte calculation of a value
> of a
> variable for the current observation.
That's not what it does. Here's a link to the documentation:
http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212547.htm
Mike Zdeb has given you one way to do what you want. See also:
http://www.sascommunity.org/wiki/Four_methods_of_performing_a_look-ahead_read
--
Jack Hamilton
jfh@alumni.stanford.org
Tots units fem força!
On May 29, 2009, at 5:49 am, Randall Powers wrote:
> Hello All,
>
> I am familiar with the LAG function. It allows you to use a value of a
> variable from the previous observation in hte calculation of a value
> of a
> variable for the current observation.
>
> What I need to to is if there is a function which allows you to take a
> value of a variable in the NEXT observation and use it in operations
> on the
> current observation. If so, what is it?
>
> For example, I want to take the value of the variable UNIT in from the
> observation that follows my current one and assign it to a new
> variable in
> the current observation.
>
> something like:
>
> if unit='.' then unit1=next(unit);
>
> I don't think "next" is what i want, but what is?
>
> Thanks,
>
> Randall