18.4k views
0 votes
During each execution of the following DO loop, the value of Earned is calculated and is added to its previous value. How many times does this DO loop execute?

data finance.earnings;
Amount=1000;
Rate=.075/12;
do Month=1 to 12;
Earned+(Amount+Earned)*Rate;
end;
run;
a. 0
b. 1
c. 12
d. 13

User Yurmix
by
7.6k points

1 Answer

4 votes

Final answer:

The DO loop in the finance code sample provided executes 12 times, calculating and accumulating the value of Earned for each month in a year.

Step-by-step explanation:

The loop described in the question executes a block of code that calculates the value of Earned and accumulates it over a period defined by the do Month=1 to 12 loop.

Each time the loop executes, the Earned amount is calculated by adding the interest earned for that month to the total Earned value so far. The loop repeats this process consecutively from Month=1 to Month=12, which means the loop executes a total of 12 times.

User Sisimh
by
7.8k points