@GS2 wrote:
Using SAS 9.4
I am trying to split '01/01/2019' in mmddyy10. format to get only the year 2019 from the date.
I have ran this code to try and pull the year out but it is not working. Any help would be appreciated. Thank you
For future reference, it's never enough to tell us that its not working. We need more information than "it's not working". We would need to see the log (not just the error messages, but the log for the entire DATA step) and/or other indications of it not working.
I'm guessing that in this case, it seems as if your date is a numeric SAS date value, and so SUBSTRN will not work on numbers, it only works on characters. So the year function ought to do what you want, if it is truly a SAS date value.
what_year = year(date);
--
Paige Miller