Using Conditional Clauses with the Iterative DO Statement
Previous examples showed that the DO WHILE and DO UNTIL
statements enable you to execute statements conditionally and that
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;
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;
Figure 15.5 SAS Data Set Work.Invest: Number of Years for an Investment
to Reach $50,000
Suppose you also want to limit the number of years you invest your capital ...
Get SAS Certification Prep Guide, 4th 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.