data xxx; input v1-v5 ind1 ind2; cards; 1 0 1 1 0 34 23 0 0 0 1 1 22 32 1 1 0 1 0 12 10 0 1 1 0 1 56 90 ; run;
%macro mylogit(num); %do i = 1 %to # proc logistic data=xxx des; model v&i = ind1 ind2; run; %end; %mend; %mylogit(5)
/***another try with variable names*****/ %macro mylogit1(all_deps); %let k=1; %let dep = %scan(&all_deps, &k); %do %while(&dep NE); proc logistic data=xxx des; model &dep = ind1 ind2; run; %let k = %eval(&k + 1); %let dep = %scan(&all_deps, &k); %end; %mend; %mylogit1(v1 v2 v3) %let test = v1 v2 v3 v4 v5; %mylogit1(&test)