I have a macro loop that isn't processing in SAS, but error log simply spits back the code to me with no explanations. Program is run from the top so no chance of overwriting or missing data; interestingly enough, the same code worked earlier. Restarting SAS doesn't work either.
data work.tda_&i&j;
set work.tda2;
where month(datepart(month_date))=&j and
month((OpenDate))>=&j and
year(datepart(month_date))=&i and
year((OpenDate))=&i and
EAS_Prod Contains 'JUMBO';
run;
proc means data=work.tda_&i&j n sum mean;
class Dimension Cterm ;
var CurBal ;
run;
Hi:
The %MACRO/%MEND will only DEFINE the macro program and put it into the WORK.SASMACR catalog. You must still INVOKE the macro program.
What errors do you see in the log (if any) when you INVOKE the macro program? How do you know that the macro loop isn't "processing"? Have you turned on the debugging options before you INVOKE the macro program:
[pre]
options mprint symbolgen mlogic;
Like Cynthia said, you didn't show a statement where you are calling your macro (i.e., a statement like:
%loop
)
The only other thing I can immediately think of is that your data may not be the same as when you have run the code in the past. Specifically, I was surprised to see a variable called month_date, but used in a function that requires a datetime variable.
Your code appeared to run correctly on my computer.
Also, consider that the WHERE statement you have coded will also work directly with PROC MEANS, unless you have additional purpose for creating your DATA step file work.tda_&i&j.
At a minimum, if your input file is rather large, consider creating an INDEX or otherwise a VIEW to use with your program most efficiently.