DATA Step, Macro, Functions and more

lag function

Reply
Regular Contributor
Posts: 201

lag function

[ Edited ]

Hello everyone,

 

Is there a lag like function can get reversed lag without merging tables?

 

currently we have lag1(var),lag2(var).......,can we do something like lag(var,-1),lag(var,-2)......? this avoid merge tables.

 

 

Thanks!

PROC Star
Posts: 7,356

Re: lag function

If by reverse lag you mean look ahead, I don't think so. But it's quite easy, see: http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back

 

Art, CEO, AnalystFinder.com

 

Regular Contributor
Posts: 201

Re: lag function

Thank you art, while this method still need to merge table.
Contributor
Posts: 22

Re: lag function

If you are able, you could sort in the reverse way and use the lag function to get the "reverse" lag.

Ask a Question
Discussion stats
  • 3 replies
  • 88 views
  • 0 likes
  • 3 in conversation