Thanks @Tom @Reeza Below is the code that works. If i may ask a follow-up question, what if i want to fill in the missing birthdays with the values from files when month ends with 07? Currently using the following code, birthdays will be missing if month doesn't end with 07, what if i want to fill in those missing birthdays using values from 07 files by ID (uci)?
%macro loop(out=total,from=,to=);
%local fromdate todate i month ;
%let fromdate = %sysfunc(inputn(&from.01,yymmdd6));
%let todate = %sysfunc(inputn(&to.01,yymmdd6));
%put &=fromdate %sysfunc(putn(&fromdate,date9));
%put &=todate %sysfunc(putn(&todate,date9));
%do i= 0 %to %sysfunc(intck(month,&fromdate,&todate));
%let month=%sysfunc(intnx(month,&fromdate,&i),YYMMN4);
data current;
set LCMF.cm20&month (keep=UCI Status RCAbrv birthday);
month=&month.;
uci_0=input(uci,12.);
%if %substr(&month, 3, 2) ne 07 %then %do;
call missing (birthday);
%end;
run;
proc append data=current base=&out force;
run;
%end;
%mend;
proc delete data=total ; run;
%loop(out=total,from=1708,to=1807);
... View more