I have the following code:
%macro groupthem(a,grpmin,grpmax);
data testr;
set test;
amt_grp&a=0;
%do i=1 %to rval;
%do %until (amt_grp&a eq 1);
%if %sysevalf((&grpmin)<=(amt_min/1000)<(&grpmax)) %then
amt_grp&a=1;
%end;
%end;
run;
%mend;
%groupthem(1,10,24.99999);
I have a couple of issues here, I want to use rval as the upper limit of iterations of the do loop. rval is defined for each obs in a prior data step, it is an integer.
I want the if statement to evaluate the value of amt_min, which is numeric. If the condition is true I want to change the value of amt_grp to 1 and exit the do loop. The amt_grp=1 will be used later to identify obs that fit into said group....
I repeatedly get an error stating the %eval function encountered a character when expecting a numeric. I cannot get macro to exit the loop properly nor can I get the rval, or upper bound to be recognized by sas. suggestions?