You don't need to do BY date, since date seems to unique, and you want to keep track on different CustId.
Try to change to:
if not first.CustId then do;
Diff=intck('month', lag(timekey),timekey);
if diff eq 1 then output;
With this you have multiple records per custId in your output.
The . means missing. You tried to compare a value from observation 1 minus 1, and that observation does not exist...
Regards,
Linus
Data never sleeps