04-28-2016 05:01 PM - last edited on 04-29-2016 06:31 AM by LinusH
I want to create a macro variable for last year and the month should be July(current month + 3) .
For example : it should be display as 01JUL2015
I have tried the below.
call symput('previous_year',put(intnx('month',today(),),intnx('year',today(), -1, 'S'),0,'B'),date9.));
%put &previous_year ;
Please let me know.
04-28-2016 05:09 PM
It looks like you're making this a little too complicated. How about:
call symput('previous_year', put(intnx('month', today(), -9), date9.));
Last year + 3 months is the same as going back 9 months.
04-29-2016 04:59 AM
What is the point in putting a date in a macro variable? You know the formula you want to use, so why not just use that in your code where you need to rather than setting up a text string (which is what a macro variable is), and then messing around with trying to use that as a date.