Looping and Combining
Data
STAT 342 – Fall 2020 Tutorial – 8
Looping
• Do Group: multiple conditions with if
• Do Loop: running same code multiple times over a specified range of values / groups
• Integers
• Decimal
• Forward / backward
• Do Until:
• An important point to remember about DO UNTIL is that the condition, placed in parentheses after the keyword UNTIL, is tested at the bottom of the loop. Therefore, a DO UNTIL loop always executes at least once.
• Do While:
• An alternate to Do until but checks the condition at the beginning of the code. Thus, can exit the code even without executing the code.
Combining Data
• Adding observations to a dataset • Interleaving datasets
• Merging datasets