data retail;
input id date date9. time hh:mm:ss;
format date date9. time hh:mm:ss ;
datalines;
1 18Jun2018 13:25:21
2 28Jun2018 11:33:21
3 29Jun2018 11:24:21
4 29Jun2018 13:25:45
6 21Jun2018 9:59:05
;
run;Time reading variable error
Once again, Maxim 1: Read the Documentation!!
hh:mm:ss is not a valid informat, in fact it is not even a valid SAS name.
And also read up the documentation for the input statement, list input; and how to use formats in list input.
As mentioned by @Kurt_Bremser, this is not a valide format.
You can use ":informat." in the input statement to specify how to interpret input values, and then specify the format for display :
data retail;
input id date:date9. time:time8.;
format date date9. time time8. ;
datalines;
1 18Jun2018 13:25:21
2 28Jun2018 11:33:21
3 29Jun2018 11:24:21
4 29Jun2018 13:25:45
6 21Jun2018 9:59:05
;
run;
-> You can see that SAS reads correctly the date and the time variables.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.