30 likes | 311 Views
End of Month Macro. /*Use when something should run only on the last day of the month*/ data _null_; call symput('now',PUT(today(),DATE9.)); /*today*/ run; data _null_; nextbeg = intnx('month',"&now"D,+1); /*beginning of next month*/ endofmo = nextbeg - 1; /*last day of current month*/
E N D
End of Month Macro /*Use when something should run only on the last day of the month*/ data _null_; call symput('now',PUT(today(),DATE9.)); /*today*/ run; data _null_; nextbeg = intnx('month',"&now"D,+1); /*beginning of next month*/ endofmo = nextbeg - 1; /*last day of current month*/ call symput('endofmo',PUT(endofmo,DATE9.)); run; %put &now; %put &endofmo; %macro tagmo; %if &now eq &endofmo %then %do; /*Check if today is last day of month*/ /*Code that needs to be run on the last day of the month*/ %end; %mend tagmo; %tagmo;