The following SAS program is submitted:
data WORK.TOTAL_SALARY;
retain Total;
set WORK.SALARY;
by Department;
if First.Department
then Total=0;
Total=sum(Total, Wagerate);
if Last.Total;
run;
What is the initial value of the variable Total?
A. 0
B. Missing
C. The value of the first observations Wagerate
D. Cannot be determined from the information given
Answer: B
注解:The second line of codes, retain Total, initializes the variable Total. As it doesn’t specify an initial value, a missing value is assigned to the variable. Please also check SAS Base (32) for the details of RETAIN statement.