I agree that one must take care when coding a %DO loop inside any PROC or DATA step.

In this case, each iteration of the %DO loop generates more IML statements. More statements translates into increased memory use and time to compile the program. Using an IML DO loop creates a much smaller program and more efficient compilation.