Hi please try this :I just made some nesting for fiinding the "/" data tocorrect;
input date_to_amend $30. ;
datalines;
1/25/2017 4:49:01 PM
12/1/2017 12:07:00 PM
;
run;
data corrected ;
set tocorrect;
format sasdate DATE9.;
format month 8.;
format day 8.;
format year 8.;
month=substr(date_to_amend,1, find(date_to_amend,"/")-1);
day=substr(substr(date_to_amend, find(date_to_amend,"/")+1,length(date_to_amend)),1, find(substr(date_to_amend, find(date_to_amend,"/")+1,length(date_to_amend)),"/")-1);
year = substr(substr(date_to_amend,1, find(date_to_amend," ")-1),length(substr(date_to_amend,1, find(date_to_amend," ")-1))-3,4);
sasdate=mdy(month,day,year);
run;
... View more