Iterated do loops ALWAYS go until the condition is no longer true. Since there is no increment included I increments by one until the value is greater than the limit.
Hint: With short examples like this type the code into your SAS editor and run it.
Maybe place some put statements in various places to see what changes where/when.
Consider this short program. Copy and paste into your editor and run it then read the LOG.
data example;
do i= 0 to 5;
put "in loop " i=;
end;
put 'after loop ' i=;
run;
You can look in the log to see what happens at each iteration and examine the data set to see what the value is when the data set is created.
Then look at this one:
data example2;
do i= 0 to 15 by 5;
put "in loop " i=;
end;
put 'after loop ' i=;
run;
"why there is a iterative do loop within the original do loop?" Better to say OUTER than original. Looks like someone is simulating a 10% increase in a value every calendar quarter within each year. Maybe a crude compound interest accumulation.