Using Conditional Clauses with the Iterative DO Statement

You have seen how the DO WHILE and DO UNTIL statements enable you to execute statements conditionally and how the iterative DO statement enables you to execute statements a set number of times, unconditionally.
DO WHILE (expression); 
DO UNTIL(expression); 
DO index-variable=start TO stop BY increment;
Now let's look at a form of the iterative DO statement that combines features of both conditional and unconditional execution of DO loops.
In this DATA step, the DO UNTIL statement determines how many years it takes (13) for an investment to reach $50,000.
data work.invest; 
   do until(Capital>=50000);  
      Year+1; 
      capital+2000; 
      capital+capital*.10; 
   end; 
run;
Suppose you also want to limit ...

Get SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.