I have a character variable in a SAS table that is populated with a non-usual type of date time. Indeed, it has the following format : YYYY-MM-DDT00:00:00.000+00:00
. Here is an example: 2020-01-01T00:00:00
.
I want to transform this character column to a date column. I have been searching in the documentation an associated format but did not find the correct one.
I found $E8601DZ.
($E8601DZ. format) which results for example in: 2020-01-01T00:00:00+00.00
(notice the .000
missing after the seconds) and $E8601DTw.d
($E8601DTw.d format) which results for example in: 2020-01-01T00:00:00.000
(notice the +00:00
missing).
Thus, would it be possible to "mix" those two formats resulting in a custom format that will create a date variable with the desired format ?
SAS Code
:
data example;
date="2020-01-01T00:00:00.000+00:00";
run;