BookmarkSubscribeRSS Feed

[SAS Programming]SAS Certified Advanced Programmer 덤프3 풀이 32-34

Started ‎11-13-2020 by
Modified ‎11-13-2020 by
Views 434

#32. Given the following SAS data set ONE:

ONE 
CATEGORY AGE SALARY BONUS
M        28  200    .
M        25  100    10
F        18  100    50
F        25  200    10

The following SAS program is submitted:

proc sql;
    create table two as
        select category, salary + bonus as EARNINGS from one;
quit; 

 Which one of the following represents the data values stored in the data set TWO?

 

A.

CATEGORY EARNINGS
M        200
M        110
F        150
F        210

B.

CATEGORY EARNINGS
M        .
M        110
F        150
F        210

C.

CATEGORY SALARY BONUS EARNINGS
M        200    .     200
M        100    10    110
F        100    50    150
F        200    10    210

D.

CATEGORY SALARY BONUS EARNINGS
M        200    .     .
M        100    10    110
M        200    .     200
M        100    10    110
F        100    50    150
F        200    10    210 

[정답] B

[풀이]

proc sql;

    create table two as

        select category, salary + bonus as EARNINGS from one;

quit;

 

이 문제는 proc sql의 select연산과 null값의 연산 관련된 문제입니다.

select에서 salary + bonus로 새로운 변수 earnings를 생성하였습니다.

데이터 값이 NULL인 경우 사칙연산을 할 경우 결과값은 NULL이 됩니다.

그리므로 200 + . .(NULL) 됩니다.

 

#33. Which one of the following SAS SORT procedure options eliminates identical consecutive observations?

A. NODUP
B. UNIQUE
C. DISTINCT
D. NODUPKEY

 

[정답]A

[풀이]

PROC SORT에는 중복을 제거하는 NODUP(or NODUPRECS)옵션과 NODUPKEY 두 가지 옵션이 존재합니다.

먼저 NODUPRECS의 약칭이 NODUP이고, 이 용어의 의미는 "No Duplicate Records"입니다. 

NODUP(or NODUPRECS) : 중복된는 객체를 모두 지우기

 

+) NODUPKEY : key가 중복되는 모든 객체를 지우기

 

34. The following SAS program is submitted:

data temp;
    array points { 3,2 } _temporary_ (10,20,30,40,50,60);
    score = points { 2,1 };
run;

Which one of the following is the value of the variable SCORE in the data set TEMP?

A. 10
B. 20
C. 30
D. 40

 

[정답] C

[풀이]

*array(배열)

단일 이름하에 변수들을 임시적으로 집단적으로 묶는 것입니다.

배열은 변수를 처리하기 위해 필요한 statement의 수를 감소시키고 data step program의 유지를 간단하게 합니다.

이미 정의된 data set변수들을 배열로 묶기위해, 변수 구성요소를 명시하기 위해 variable list를 사용합니다.

변수목록의 형때에 따라 숫자변수 또는 문자변수, 순서화된 변수범위를 명시할 수 있습니다.

data setp에 배열을 정의할 때 각 구성요소에 index value가 할당됩니다. 

특정 배열 구성요소에 action을 수행하기 위해 array reference를 사용할 수 있습니다.

 

*array문법

array 배열이름 { 차원수 } 내용 ; 

-> 1차원에서 개수는  * (모든개수)로 표현가능합니다.

여기서는 3행 2열을 나타내는 코드입니다.

 

data temp;

array points { 3,2 } _temporary_ (10,20,30,40,50,60);

score = points { 2,1 };

run;

 

[테이블로 표현]

10

20

30

40

50

60

 

 

 

 

-> {2,1}의 값은 30으로 답은 C입니다.

 

Version history
Last update:
‎11-13-2020 10:46 PM
Updated by:
Contributors

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

Article Labels
Article Tags