DO LOOP in SAS University Edition || DO LOOP, DO WHILE, DO UNTIL in SAS with Examples

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • LOOPS: When you want the same set of statements to be executed again and again, then we can use Loops.
    3 Types: 1.Do Loops
    2.Do While
    3.Do Until
    In SAS looping is done by using DO statement. It is also called DO Loop.
    (1)DO LOOP:
    When u know the range in which you want to iterate if you tell SAS to do something for 20 times, SAS will do it 20 times regardless. We call those kinds of loops as iterative DO loops.
    Syntax:
    DO index-variable = start TO stop BY increment;
    action statements;
    END;
    Conditional DO Loops (if you want to iterate based on a condition)
    (2) DO WHILE:
    To do something while a particular condition is met, We call that as a DO WHILE Loop. (while the condition is true)
    (3) DO UNTIL:
    To do something until a particular condition is met, We call that as a DO UNTIL Loop (while the condition is false)

КОМЕНТАРІ • 4