110k views
0 votes
For the program below, select the interative DO statement that processes all elements in the contrib array.

data work.contrib;
array contrib{4} qtr1-qtr4;
_____________
contrib{i}=contrib{i}*1.25;
end;
run;
a. do i=4;
b. do i=1 to 4;
c. do until i=4;
d. do while i le 4;

1 Answer

7 votes

Final answer:

The correct DO statement to process all elements in the contrib array in a SAS program is 'do i=1 to 4;'. It iterates through the array elements from the first to the last one.

Step-by-step explanation:

The student has asked for the correct iterative DO statement to process all elements in the contrib array in a SAS program. The array has 4 elements, named qtr1 to qtr4.

To process all of these elements, the DO statement should begin with the first element of the array and end with the last. The correct DO statement for this purpose is 'do i=1 to 4;'. This statement initiates a loop that starts with i=1 and processes each element in turn until i=4, thus ensuring all elements of the contrib array are processed exactly once.

User Michel Michels
by
8.7k points