19.A raw data file is listed below.
1---+----10---+----20---+--- 1901 2
1905 1
1910 6
1925 1 1941 1
The following SAS program is submitted and references the raw data file above:
data money;
infile 'file-specification'; input year quantity; total=total+quantity;
run;
What is the value of total when the data step finishes executing?
a. 0
b. 1
c. 11
d. .(missingnumericvalue)
Correct answer: d
47.The following SAS program is submitted: data work.travel;
do i=1 to 6 by 2;
trip + i;
end;
run;
Which one of the following is the value of the variable trip in the output data set?
a. 2
b. 3
c. 9
d. 10
Correct answer: c
The sum variable in a sum statement is automatically set to 0 before the first observation is read from the data set. The sum variable in the statement above is increased by the value of i on each iteration of the DO loop; the value of i is set to 1 on the first iteration of the DO loop and increases by 2 on each additional iteration until it is greater than 6. Therefore, the value ofTripis equal to 0 + 1 + 3 + 5, which is 9.
不是应该i=1,3,5吗?那个9 是怎么算出来的?