Hi @sylvia106 Sorry late to the party. Your pattern seems pretty straight forward and convenient to just read the datepart with the appropriate informat. In your sample, the date part of the date-time character value appears to be in the form MMDDYY.
What you could do is, just read upto 10 bytes of character by specifying the informat width as 10 i.e. mmddyy10. . Internally, SAS reads 10 bytes of char which in other words is a non-standard date. The pre-compiled INFORMAT will look up i.e. assign the appropriate integer date value. Then, you can of course assign a format of your choice.
data tocorrect;
input date_to_amend $30. ;
datalines;
1/25/2017 4:49:01 PM
12/1/2017 12:07:00 PM
;
run;
data want;
set tocorrect;
sas_date=input(date_to_amend,mmddyy10.);
format sas_date date9.;
run
... View more