Hi,
I have a large dataset where the dates are in format '$27' and displayed like '
2018-09-01 14:21:51:333 GMT'. I need to convert this to datetime13 or datetime18. What would be the best way to do this?
Thanks in advance for any help given!
data want;
have='2018-09-01 14:21:51:333 GMT';
want=input(have, ymddttm19.);
format want datetime20.;
run;
data want;
have='2018-09-01 14:21:51:333 GMT';
want=input(have, ymddttm19.);
format want datetime20.;
run;
This worked 😄
Thanks!
@JackoNewbie wrote:
Hi,
I have a large dataset where the dates are in format '$27' and displayed like '
2018-09-01 14:21:51:333 GMT'. I need to convert this to datetime13 or datetime18. What would be the best way to do this?
Thanks in advance for any help given!
If you can, fix the creation of that datasets, so that a proper datetime-variable is created. There is hardly any good reason for storing datetimes as strings at all.
Do you really have datatime values with different time zones than GMT?
If so do you need the values adjusted so that they are synchronized to a single time zone?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.