SAS Crambible 16

Adios_Hosang·2022년 9월 30일
0

SAS crambible

목록 보기
16/20

Q16.

The following SAS program is submitted:

data work.accounting;
set work.department;
length jobcode $ 12;
jobcode='FA1';
run;

The WORK.DEPARTMENT data set contains a character variable named JOBCODE with a length of 5.
What is the result?

A. The length of the variable JOBCODE is 3.
B. The length of the variable JOBCODE is 5.
C. The length of the variable JOSBODE is 12.
D. The program fails to execute due to errors.

정답은 B입니다.

이 문제는 Length 문의 특성을 묻는 문제입니다.
Length문으로 변수의 길이를 지정해주려면 data구문과 set구문 사이에 위치해야 합니다. 즉, 아래와 같이 작성이 되어야 하는거죠.

data work.accounting;
length jobcode $ 12;
set work.department;
jobcode='FA1';
run;

하지만, 위 문제는 그렇지 않기 때문에 기존에 설정된 길이를 따릅니다.
기존에 설정된 값은 5이므로 답은 B입니다.

profile
IT를 시작하고자 합니다

0개의 댓글