I want to merge the returns in one file with the returns in another file using the date as the variable for combining. But dates in two files have some differences. So I need to convert them into a new format. I have written the following code. Any one could you pls help me with this code? Its not working.

data Libname.factors_sorted;
set Libname.factors_sorted2;
Factor_month=month(date1);
Factor_year=year(date1);
Factor_newdate=mdy(Factor_month,1,Factor_year);
Run;

data Libname.Funds_return_updated2;
set Libname.Funds_return_updated4;
Return_month=month(date2);
Return_year=year(date2);
Return_newdate=mdy(Factor_month,1,Factor_year);
Run;