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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.