SAS BASE Q51. 세미콜론(;) / 추가 문제
QUESTION NO: 51
The following SAS program is submitted:
data work.retail;
cost = '20000';
total= .10* cost
run;
What is the result?
A. The value of the variable TOTAL in the output data set is 2000. No messages are written to the SAS log.
B. The value of the variable TOTAL in the output data set is 2000. A note that conversion has taken place is written to the SAS log.
C. The value of the variable TOTAL in the output data set is missing. An error message is written to the SAS log.
D. The variable TOTAL in the output data set has no value. The program fails to execute due to a syntax error.
Answer: C
# 문제 풀이
- total 구문 뒤에 세미콜론(;)이 없으므로 구문오류(syntax error)가 난다. 따라서 데이터가 생성되지 않는다.
- D번 보기는 데이터 셋이 만들어지지만 값이 존재하지 않는다는 말이기 때문에 정답이 아니다. -> 데이터 셋 생성이 안됨.
- 만약 세미콜론이 있다면 : cost는 문자형변수인데 total에서는 곱셈(숫자형)을 수행하고 있다. 이 경우 sas에서 자동으로 숫자로 인식하여 total값을 계산해준다. 다만 log에 error message가 뜬다.