I have a birthdate such as 01SEP60:00:00:00.
Length = 8
Format datetime16.
Informat anydtdtm40.
I want to get the year of this string. I tried birth_year = year(input(birthdate,anydtdte20.)); I did not get any erro but every birth_year came out as missing.
Thank you!
b_y = year(datepart(birthdate));
?
Bart
b_y = year(datepart(birthdate));
?
Bart
So you don't have a DATE (number of days). You have a DATETIME (number of seconds).
The YEAR() function needs a DATE value. You can convert a DATETIME value to a DATE value by using the DATEPART() function.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.