Thank you again all responders. Dan your solution was both easy & miraculous. -- View this message in context: http://r.789695.n4.nabble.com/Can-you-have-a-by-variable-in-Lag-function-as-in-SAS-tp4649647p4649773.html Sent from the R help mailing list archive at Nabble.com.