Hi All,
I have a date variable which I want to display like this YYYYMMDD:HH:MM. I don't want to display the seconds value. I am not able to find any date time format which will help me in the above scenario.
Can anyone tell me how to do this. Do we have any format available to do this?
id date
101 2021-01-21:15:25
102 2021-02-15:08:30
...
Shantanu
Format datetime14. will not display seconds.
Format e8601dt16. will not display seconds.
And probably many others...
Thank you.
But if I want the complete year then what should we do. Because using datetime14. will give the year values in 2 digit.
Thanks & Regards
Shantanu
Thank you.
It worked using picture statement.
Yes, that's good to hear.
I never realized this particular deficiency of the DATETIME. format: you can't chop off the seconds and get 4 digits years.
But if we create a picture format apply the format it converts the variable into a numeric variable not a date variable. Do you have any way to overcome this so that the variable should remain a Date variable after we apply the user defined format.
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.