Quiz:
Generating
Data with DO Loops
Select the best answer for each question and click Score My Quiz.
-
Which statement is false
regarding the use of DO loops?
-
During each execution of the DO
loop, the value of
Earned is calculated and 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;
-
On January 1 of each year, $5000
is invested in an account. Complete the DATA step below to determine
the value of the account after 15 years if a constant interest rate
of ten percent is speculated.
data work.invest;
...
capital+5000;
capital+(capital*.10);
end;
run;
-
In the data set Work.Invest,
what would be the stored value for
Year ?
data work.invest;
do year=1990 to 2004;
capital+5000;
capital+(capital*.10);
end;
run;
-
Which of the following statements
is false regarding the program shown below?
data work.invest;
do year=1990 to 2004;
capital+5000;
capital+(capital*.10);
output;
end;
run;
-
How many observations will the
data set Work.Earn contain?
data earn;
value=2000;
do year=1 to 20;
interest=value*.075;
value+interest;
output;
end;
run;
-
Which of the following would you
use to compare the result of investing $4,000 a year for five years
in three different banks that compound monthly? Assume a fixed rate
for the five-year period.
-
Which statement is false
regarding DO UNTIL statements?
-
Select the DO WHILE statement
that would generate the same result as the program below.
data work.invest;
do until(capital gt 500000);
year+1;
capital+(capital*.10);
end;
run;
-
In the following program, complete
the statement so that the program stops generating observations when
Distance exceeds 250 miles or when 10 gallons of fuel
have been used.
data work.go250;
set perm.cars;
do gallons=1 to 10 ... ;
distance=gallons*mpg;
output;
end;
run;
|