What is the SAS datetime informat for the datetime value of 2021/08/19 18:00:54+00?
I have tried the ISO8601 datetime informat and datetime20. format but that does not work.
The column is a double and has a date format but all the values in the column are NaT
I am using SAS Viya for Python
Yes the new column does. I wanted to convert to show up as a Date format only. No time. However I can't find the right datetime informat so I can load the data into CAS with the informat and format in one step at the beginning.
Since I can't find the informat or it doesn't exist I have to extract the first part then use an informat that is known but that requires more steps.
If you just want the date component, read it with a date informat and limit the character count - see the want_date variable.
This does not read the time zone component correctly, but gets you close.
data want;
have = '2021/08/19 18:00:54+04';
change_look = trim(translate(have, '-T', '/ '));
want = input(change_look, E8601DT.);
want_date = input(have, yymmdd10.);
format want datetime22. want_date date9.;
run;
proc print;run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for 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.