Thank you. While you state his code is faster, you did show me a use of _n_ I was not aware of. This is very valuable!! I actually ended up going wiht a PROC SQL step to get the count, then used the count in a macro, then the macro to limit my outputs. PROC SQL; CREATE TABLE WORK.OBS_MACRO AS SELECT count(Month_Day) AS MAX_CT FROM WORK.IFF_IN_OUT_CHANGE4; QUIT; *make macro for last 5 obs; DATA _NULL_; SET WORK.OBS_MACRO; CALL SYMPUTX ('MAXCT',MAX_CT,'g'); RUN; %put &MAXCT; DATA WORK.IN_OUT_LAST5; SET WORK.IFF_IN_OUT_CHANGE4; IF _N_ >= (&MAXCT-4) THEN OUTPUT; RUN;
... View more