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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: