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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.