This works for your sample data, but is your sample data representative of you actual data. data stale; input DATE PRICE; d = dif(price); cards; 1995 3 1996 4 1997 2 1998 2 1999 2 2000 3 2001 4 2002 5 2003 2 2004 2 2005 2 2006 2 ;;;; run; data stale2; do _n_ = 1 by 1 until(eof1); set stale end=eof1; by d notsorted; if first.d and d eq 0 then _obs_=_n_; end; do _n_ = 1 by 1 until(eof2); set stale end=eof2; if _n_ lt _obs_ then output; end; stop; run;
... View more