SAS OnlineTutorback||next

Try It! Execute a DO loop while a condition is true.

Creating HTML output? Read this first.

  1. Copy the program below and paste it into the Program Editor window (or issue the command copy sashelp.oltutor..source).
    data work.retire;
       Savings=8000;
       Income=42000;
       do until(savings>=1000000);
          Year+1;
          income+(income*.04);
          savings+(income*.10);
       end;
    run;
    proc print data=work.retire;
    run;
    
    Submit the DATA step. Note the Savings value.

  2. Recall the program and change the DO UNTIL statement to a DO WHILE statement to calculate the years required to reach $1,000,000.

  3. Submit the program again and compare the results of Savings to the value of the first program. The value should be the same for both programs.

    Return here and select Next.

Solution
back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA.
All rights reserved.

Terms of Use & Legal Information | Privacy Statement