I am trying to create multiple flags in my dataset GB1_1, GB1_2, ....... GB1_36, but failing miserably, how do I create numeric variables using macro code (below is what I tried) %macro gb1(howmany); %do i=1 %to &howmany; %if status&i = 1 %then %let &gb1_&i = %syseval(1*1); %else %if status&i = 2 %then %let &gb1_&i = %syseval(1*1); %else %if dpd&i >= 2 %then %let &gb1_&i = %syseval(1*1); %else %if ((dpd&i < 2) and (dpd&i >= 1)) %then %let &gb1_&i = %syseval(2*1); %else %let &gb1_&i = %syseval(0*1); %end; %mend gb1; GB takes the value 0,1,2 dependent on the conditions above please help
... View more