LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Feb 2001 01:32:09 GMT
Reply-To:     Lou Pogoda <lpogoda@HOME.NOSPAM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Lou Pogoda <lpogoda@HOME.NOSPAM.COM>
Organization: Excite@Home - The Leader in Broadband http://home.com/faster
Subject:      Re: Opposite of LAG  *SOLUTION*

How about something like

***************************; **make some test data**; ***************************; data fee; do n = 1 to 10; output; end; stop; run; ********************************************; **add the lead of n to each observation**; ********************************************; data fee; merge fee fee (firstobs = 2 keep = n rename = (n = nlead)); -------more SAS statements------- run;

You can change the "firstobs = 2" to lead ahead as many times as necessary.

John J. Shon wrote in message ... >I think this may be the first time I'm actually _contributing_ to this list. I don't remember who pointed it out to me, but the most direct way to get an opposite of a lag is using PROC EXPAND, like this: > >PROC EXPAND DATA=inn OUT=outt; > BY cus; > ID yr; > CONVERT var=var1 / TRANSFORM=(lead 1); > >You can change the "lead 1" to "reach ahead" as many times as necessary. Hope this helps. > >John > > > >>From: Roland >>Reply-To: roland.rashleigh-berry@virgin.net >>To: SAS-L@LISTSERV.UGA.EDU >>Subject: Re: Opposite of LAG >>Date: Mon, 26 Feb 2001 19:59:08 +0000 >> >>Try http://www.sconsig.com/tip00203.htm >> >>Roland >> >>Manktelow, B. wrote: >> > >> > Hi, >> > Is there a function that is the opposite of LAG, that is, it looks at the >> > next observation as opposed to the previous? >> > >> > I know that I could reverse sort the data set but I would rather not. >> > >> > I am using v8.00. >> > >> > Many thanks, >> > Brad >> > >> > bm18@le.ac.uk > > >--------------------------------------------------------------------------- ----- >Get your FREE download of MSN Explorer at http://explorer.msn.com > > >


Back to: Top of message | Previous page | Main SAS-L page