Hi,
I have the following dates in a .xlsx file:
23Feb2021 15:57:13.00
23Feb2021 18:36:25.00
23Feb2021 18:52:04.00
23Feb2021 19:00:56.00
22Feb2021 16:44:40.00
24Feb2021 17:09:48.00
(their Excel numeric equivalents:)
44250.66473379629
44250.77528935185
44250.786157407405
44250.79231481481
44249.69768518519
44251.7151388889
I have the following code in a proc sql (having to input as the column is being read as character, due to actual SAS formatted dates (datetime19.) being in the same column for some reason, and thus being treated as char):
select (input(Created,8.) - 21916)*86400 as Created_E format datetime19.
And I get the following outputs in SAS:
23FEB2021:15:50:24
23FEB2021:18:28:48
23FEB2021:18:43:12
23FEB2021:18:57:36
22FEB2021:16:33:36
24FEB2021:17:02:24
Why are my dates all around 5-11 minutes out, please?
The 8. informat cuts off all digits after the first 8.
Is the variable "created" in fact character, or is it numeric?
If character, use the 32. informat (the maximum length) in the INPUT function; otherwise, use the variable as is.
The 8. informat cuts off all digits after the first 8.
Is the variable "created" in fact character, or is it numeric?
If character, use the 32. informat (the maximum length) in the INPUT function; otherwise, use the variable as is.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.