does somebody now how to read a datetime string like "2023-04-30T00:00:00.000+02:00" into a sas table?
I'm looking for a suitable informat. Something like anydtdtm40. (but this doesn't work).
I only need the date, by the way, time is irrelevant for me.
Thanks in advance
Perhaps this table will be of use: https://documentation.sas.com/doc/en/pgmmvacdc/9.4/leforinforref/n09mk4h1ba9wp1n1tc3e7x0eow8q.htm#p0...
data have; dt="2023-04-30T00:00:00.000+02:00"; dt_new=input(dt,E8601DZ30.3); format dt_new datetime19.; run;
Unfortunately, it doesn't work when I read the csv file.
So this part delievers only missings.
infile "/----.csv" informat ULTIMOTS E8601DZ30.3; format ULTIMOTS datetime19.; input ULTIMOTS ; run;
When something doesn't work, show us the LOG. (All of the log for this data step, every single line for this data step).
But using YYMMDD10. does not take into account the adjustment made for the time zone offset. So I cannot see how that is a correct answer.
That is for the original poster to decide.
If they don't care about the time of day then they probably do not care about a 2 hour difference either. It might be that every record has the same midnight with 2 HR offset because the values were generated from a system that only has timestamp data type.
But it it no possible to tell from a sample size of one.
data test; infile cards dsd truncover ; input id str :$29. ; dt = input(str,e8601dz29.); date1 = input(str,yymmdd10.); date2 = datepart(dt); format dt datetime19. date: yymmdd10.; cards; 1,"2023-04-30T00:00:00.000+02:00" ;
Obs id str dt date1 date2 1 1 2023-04-30T00:00:00.000+02:00 29APR2023:22:00:00 2023-04-30 2023-04-29
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.