Macro code is used to generate code that is then passed to regular SAS to be interpretted and run. Turn on MPRINT and you will see the code that your macro calls are generating. You probably just want to code a normal DO loop. So the body of your macro could be the some thing like this with the text in red being the parts you might want to replace with macro parameters. if flag = 1 then do; do date=chkdate-3 to chkdate+3 ; if date = holiday('christmas',year(ckdate)) then do; flag_desc = 'Christmas'; flag_date = ckdate ; end; end; end; I wasn't sure if you want to set FLAG_DATE to the original CHKDATE variable or to the derived holiday date that will be in the DATE variable. Actually it is probably even easier to just check if the date is within 3 days of the holiday. if -3 <= (chkdate - holiday('christmas',year(ckdate)) <= 3 then do;
... View more