You mean in the range of +/- 3 month , NOT out of the range ?
data want;
merge have have(where=(b='SCREEN') rename=(visit_date=_date));
by id;
if b eq: 'MONTH' then do;
if intnx('month',_date,-3,'s') le visit_date le intnx('month',_date,3,'s') then do;
flag=ifc(visit_date gt _date ,'BELOW','ABOVE');
end;
end;
run;
Xia Keshan