An easy tweak will do: data want; set have; array rv(0:3) _temporary_; array rvr(0:3) _temporary_; if _n_ >= 5 then rvr(mod(_n_,4))=rv(mod(_n_,4)) * exp(num); rv(mod(_n_,4)) = coalesce(rev, rvr(mod(_n_,4))); if date < = '01jan2014'd then Rev_r = rv(mod(_n_,4)); else Rev_r=rvr(mod(_n_,4)); run; However, I would recommend those solutions suggested by PG or Astounding, for the sake of easier coding. Good Luck, Haikuo
... View more