I would like to "shortcut" this function of a macro variable
intnx('YEAR',"&starting_year"D,-5,'S');
with another macro variable. Is it possible ?
something like:
%let start = intnx('YEAR',"&starting_year"D,-5,'S');
Of course this code-line doesn't work.
You can use %SYSFUNC()
to call functions in macro code. You can use the optional format specification to control how the results is converted to the text that is stored in the macro variable.
So if you start with macro variable in DATE.
format you could generate the date that was 5 years before that date like this:
%let start=%sysfunc(intnx(year,"&starting_date"d,-5,s),date9);
This would convert 20MAR1999
to 20MAR1994
. Or it would convert 29FEB04
to 28FEB1999
.