The following SAS program is submitted:
data work.clients;
calls = 6;
do while (calls le 6);
calls + 1;
end;
run;
calls = 6;
do while (calls le 6);
calls + 1;
end;
run;
Which one of the following is the value of the variable CALLS in the output data set?
A. 4
B. 5
C. 6
D. 7
A. 4
B. 5
C. 6
D. 7
4 comments:
Answer D.
Calls advances to 7 then stops in the do while loop
do you not have to put
calls = calls + 1?
@kat: you may write calls = calls + 1. I believe that is called an assignment statement in SAS. One downside of assignement statement is that it does not ignore missing values. However, you can solve it by adding a RETAIN statement.
By writing calls +1 as shown above, it is called SUM statement. It ignores the missing values.
@FU:
Even though if we use RETAIN stmt and missing value is there in input values, then also it shows the result until the missing value obs comes, hence for proper result direct arithmetic operation performed.
Post a Comment