Don't apply a format to a date, datetime or time macro-variable if you want to use in calculations.
Try
%let wanted = %sysfunc(intnx(dtyear, %sysfunc(datetime()), -1, s), e8601dt24.3);
or if you need the variable date (bad name for a variable not containing a date, but a datetime-value):
%let date = %sysfunc(datetime());
%let want = %sysfunc(intnx(dtyear, &date., -1, s), e8601dt24.3);
%put &=want;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.