Hi:
Instead of hard-coding the 10 and the 1, you can test the value of &CONDITION and create a new macro variable (perhaps, &STOP) which you could then use in your %DO loop. Something like what's shown in the log below.
Since you said that this is just a test macro program, it's not clear what the final macro program will be. However, do note that there is a HUGE difference between a macro %IF and a DATA step IF statement -- and if you eventually want to generate DATA step code with your macro program, that difference will become very relevant to your coding and debugging efforts. Also note that there is a difference between a macro %PUT statement (which does not require the text strings to be quoted) and a DATA step PUT statement (which does require text strings and character constants to be quoted). Reading up on the SAS Macro Facility will be very helpful to your coding efforts.
cynthia
[pre]
384 %macro test(condition =);
385
386 %put *********** STARTING Macro;
387
388 ** create STOP macro variable value;
389 %if &condition = a %then %do; %let stop = 10; %end;
390 %else %if &condition = b %then %do; %let stop = 1; %end;
391 %else %do;
392 %put INVALID Condition value: &condition;
393 %let stop = 0;
394 %end;
395
396 %put condition = &condition and stop = &stop;
397
398 %do i = 1 %to &stop;
399 %put i=&i stop=&stop "this is just a test";
400 %end;
401 %put ********** End of DO Loop;
402 %put **********;
403 %mend test;
404 %test(condition = a)
*********** STARTING Macro
condition = a and stop = 10
i=1 stop=10 "this is just a test"
i=2 stop=10 "this is just a test"
i=3 stop=10 "this is just a test"
i=4 stop=10 "this is just a test"
i=5 stop=10 "this is just a test"
i=6 stop=10 "this is just a test"
i=7 stop=10 "this is just a test"
i=8 stop=10 "this is just a test"
i=9 stop=10 "this is just a test"
i=10 stop=10 "this is just a test"
********** End of DO Loop
**********
405 %test(condition = b)
*********** STARTING Macro
condition = b and stop = 1
i=1 stop=1 "this is just a test"
********** End of DO Loop
**********
406 %test(condition = c)
*********** STARTING Macro
INVALID Condition value: c
condition = c and stop = 0
********** End of DO Loop
**********
[/pre]