Loop in sas
similar to other languages where we use different types of looping statements such as for loop for each while . We have three types of looping statement in sas. and all of them start with do prefix.
DIFFERENCE BETWEEN THESE loop
statement to identify when to stop the execution.
a) do iterative
Fixed number of loops
Loop 1.1do j=1 to 10 by 1;
b) Do conditional loops
there are two condition to state the stopping value using do while and do until.
do until checks condition at the bottom whereas do while checks the condition at the top of loop
Loop 1.2do until(North_Carolina gt South_Carolina);
Loop 1.3do while(North_Carolina le South_Carolina);
C) do iterative-conditional
There may be the cases where the data may be infinite loops as a result there will be loss of huge amount of computational power. In order to remove this burden we can make use of iterative conditional type of loop where both the iterative loop is defined along with the condition to stop by.
Loop 1.3do j=1 to 15 until(North_Carolina gt South_Carolina);
thank you for reading. may this help you to understand.