04-16-2017 09:36 AM - edited 04-16-2017 09:49 AM
There may be a more direct route, but the following should work:
infile cards truncover;
input dt anydtdtm.;
format dt datetime19.;
Art, CEO, AnalystFinder.com
04-16-2017 11:00 AM
I think you need to manipulate that to read it directly.
If you had the date part in the year,month,day order then you could use the B8601DT informat.
If you convert the T to a : then the ANYDTDTM informat could make a guess at what date to use.
If you know whether those dates are both in February or if one is in April and the other in October then you could read it in pieces using the appropriate informat. Or you could let SAS guess as to which informat to use by using the ANYDTDTE informat.
data have ; input @1 str $19. @1 dt1 anydtdtm19. @1 d1 mmddyy10. +1 time time8. @1 d2 ddmmyy10. @1 d3 anydtdte10. ; dt2 = input(translate(str,':','T'),anydtdtm19.); format dt1 dt2 e8601dt. d1 d2 d3 e8601da. time time8. ; cards; 02-04-2017T22:12:35 02-10-2017T10:15:00 02-10-2017T10:15 ; proc print; run;