You have a time series of data, and your current program captures the last value in each month. (BTW, I see "fflib" and some familiar variable names, is this fama-french data?).
By "I wish to filter only December data.", are you really only trying to get the last value in each year? If so, then instead of
if intck('month',date,nxt_date)>0;
use
if intck('year',date,nxt_date)>0;
Also you can use a MERGE statement to simplify your program instead of two SET statements (one conditional). It's a bit neater.
data fflib.mnme_all:
merge fflib.me_all
fflib.me_all (firstobs=2 keep=date rename=(date=nxt_date));
if intck('year',date,next_date)>0;
run;
But finally, your data appears to be monthly. So (1) your filter eliminated no data, and (2) you can use @ChrisNZ 's suggestion to use a WHERE statement with the MONTH function:
data fflib.mnme_all:
set fflib.me_all (where=(month(date)=12);
run;
... View more