So I want to run nested loop for my macro function.
Here's my code, it seem like SAS doesn't like by -1
. Is there anyway I code this to let the second loop decrease step by -1?
In this case, my yearMix = 1982
and yearMax = 1994
.
%Macro theLoop;
%Do I = &yearMin+1 %to &YearMax-1;
%Do J = &YearMax-1 %to &I by -1;
%Meaw;
%END;
%END;
%MEND theLoop;
%theLoop;
I got this error:
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &I by -1
ERROR: The %TO value of the %DO J loop is invalid.
ERROR: The macro THELOOP will stop executing.