Besides needing a macro to use %DO, you also need to get rid of the quotes, and you need to use the macro function (%scan) instead of the DATA step function (scan). Macro language does not use quotes to identify strings of characters. In combination, the new macro might look like this:
%macro loop (gball=);
%local k;
%do k=1 %to %sysfunc(countw(&gball));
%mb (%scan(&gball, &k))
%end;
%mend loop;
Then call it with (for example):
%loop (gball=123 456 789)
... View more