I tried to create new variables called nodup_supd_&m.d when ntdc_&m.d=0 (m could be 0,1,2,3). I used a do-loop which should have stopped once ntdc_&m.d changed to 1. However, it did not stop when ntdc_&m.d=1. It completed the loop until &m>3. It seems neglect the condition of "&done2" = "yes". Could someone help fix it? Thanks! %macro drug_ntdc(type,num,op); data ntdc_&type.&Num.d_wide1; set ntdc_&type.&Num.d_wide ; %let done2=no; %let m=0; %do %until (("&done2" = "yes") or (&m>3)); nodup_supd_&m.d= supd_&m.d; /*this step did not work*/ if ntdc_&m.d=1 then call symput('done2','yes'); %let m = %eval(&m+1); %end; run; %mend; %drug_ntdc(opioid,3,op=1);
... View more