나루다루

SAS BASE Q51. 세미콜론(;) / 추가 문제 본문

Study/SAS BASE

SAS BASE Q51. 세미콜론(;) / 추가 문제

나루다루 2018. 10. 31. 22:22
728x90
반응형

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가 뜬다.


 


728x90
반응형

'Study > SAS BASE' 카테고리의 다른 글

SAS BASE Q53. array & _temporary_  (0) 2018.10.31
SAS BASE Q52. data _null_  (0) 2018.10.31
SAS BASE Q50. 문자형 변수  (0) 2018.10.31
SAS BASE Q49. if문  (0) 2018.10.31
SAS BASE Q48. select ~ when 구문  (0) 2018.10.31
Comments