If one has date/time data that includes a space between the date and time, you can read it directly with the anydtdtm informat as long as you put an ampersand, after the variable in the input statement. The tip shows example code.
Once you have read your variable successfully, the number is stored internally as the number of SECONDS since January 1, 1960. so, as you can see from your "separated" DATE and TIME variables, you have successfully extracted the values from the internally stored number.
The way to control the DISPLAY of a variable (especially a variable whose value represents a date, a time or a date/time) is through the use of a FORMAT generally a statement (but for some procedures it is the FORMAT option). You have applied a FORMAT to the DATE variable (DATE9.) and to the TIME variable (time8.) in the following statements:
format date date9.;
format time time8.;
But just because you used an INFORMAT to read the value of the DATETIME variable, a FORMAT will not automatically be applied. An INFORMAT only controls how a variable is read INTO SAS. A FORMAT controls how a variable is DISPLAYED, such as with PROC PRINT or any reporting procedure.
So, you will need to apply a FORMAT to the DATETIME variable, such as:
format date date9. time time8. datetime datetime20.;
format date ddmmyy10. time time8. datetime E8601DT20.;
To find out the available list of formats to use for your DATETIME variable, you can search the documentation for the topic "Functions by Category". I show two possible formats above. If the available pre-defined formats are not adequate to your needs, then PROC FORMAT allows the use of "date-time directives" in order to give you the opportunity to format date and time and date/time variables in almost any fashion you want.
Just because Excel gives the date in that format does not automatically mean that the DATETIME informat in SAS will read it. If your date does indeed look like
DD/MM/YY HH:MMS, then as suggested (twice now) you will need to use another informat to read the value.
The ANYDTDTM informat should work for you and you have a link to the documentation in my post and a link to a tip in another posting that should help you figure out what to do.
I did not find the exact format you requested. I see 2 possible solutions:
1) you agree to use DateTime18. format for the datetime variable or
2) it is possible to make a character variable dt in the requested format.
See code below:
length dt $20;
informat datetime anydtdtm18.;
format date MMDDYY10.;
format time time8.;
input datetime &;
format datetime Datetime18.;