Try this... First let me build a sample data. data have;
do y=2016 to 2018;
do m= 1 to 12;
recruit_dt=mdy(i,1,y);
format recruit_dt date9.;
end;
end;
run; Second - remove records below 01Feb2017 like this data have (where=(recruit_dt >= '01Feb2017'd));
do y=2016 to 2018;
do m= 1 to 12;
recruit_dt=mdy(i,1,y);
format recruit_dt date9.;
end;
end;
run; Third compute the month. data have (where=(recruit_dt >= '01Feb2017'd));
do y=2016 to 2018;
do m= 1 to 12;
recruit_dt=mdy(i,1,y);
month=intck('month','01Feb2017'd,recruit_dt);
format recruit_dt date9.;
end;
end;
run; Notice that month=0 for 01Feb2017? We correct that using this.. data have (where=(recruit_dt >= '01Feb2017'd));
do y=2016 to 2018;
do m= 1 to 12;
recruit_dt=mdy(i,1,y);
month=intck('month','01Feb2017'd,recruit_dt)+1;
format recruit_dt date9.;
end;
end;
run; The last dataset should help you do this one. Hope this helps.
... View more