Hi:
I know what you mean. Sometimes macro programs can get very complicated, very fast.
My overall approach would be somewhat different, rather than hard-code OUT1, OUT2 and OUT3 or A, B and C in the DATA step, I'd let macro logic take care of the values of X based on the values of &I. I'd probably use an approach like shown below, which would allow me to increase the size of the %DO loop without changing the data set names or the SELECT.
Of course, you may have considered this design already and rejected it because of the other programming you need to do, but I thought this possibility worth posting in case other folks have a simlar question and only need the simpler approach.
cynthia
[pre]
data IN;
infile datalines;
input x $ num;
return;
datalines;
A 111
A 444
B 222
B 555
C 333
C 666
;
run;
%macro test;
%do i=1 %to 3;
%if &i = 1 %then %do; %let want=A; %end;
%else %if &i = 2 %then %do; %let want=B; %end;
%else %if &i = 3 %then %do; %let want=C; %end;
data OUT&i;
set IN;
if x = "&want" then do;
count&i + 1;
output out&i;
end;
run;
proc print data=out&i;
title "Out&i Data and Count Test for X: &want";
run;
%end;
%mend;
options mprint symbolgen;
%test;
[/pre]