BookmarkSubscribeRSS Feed

[SAS Programming]SAS Certified Advanced Programmer 덤프3 풀이 35-37

Started ‎11-22-2020 by
Modified ‎11-22-2020 by
Views 530

#35. 

The following SAS FORMAT procedure is submitted:

proc format lib = sasuser;
    value tempc 
        low < 0 = 'BELOW FREEZING'
        0<5 = 'COLD'
        5< 10= 'MILD'
        10< 15 = 'WARM' 
        15 < high = 'HOT';
run;

How is the value 10 displayed when the format TEMPC is applied?

A.10
B. MILD
C. WARM
D. BELOW FREEZING

[정답] C

 

[풀이]

*위 코드는 오류가 있는 코드 입니다.

proc format lib = sasuser;
    value tempc 
        low -< 0 = 'BELOW FREEZING'
        0 -<5 = 'COLD'
        5 -< 10= 'MILD'
        10 -< 15 = 'WARM' 
        15 -< high = 'HOT';
run;

프로그래밍할 때 if 나 case문을 많이 사용하는데 format문을 사용하면 효율적으로 사용이 가능합니다.

*문법

PROC FORMAT LIBRARY = libref;

    INVALUE <$> name value - range - set(s);

   VALUE <$> name value - range - set(s);

RUN;

 

LIBRARY = libref : format카탈로그가 저장된 libref 지정

INVALUE: informat 생성을 위한 문장

VALUE : format 생성을 위한 문장 

<$> : 문자일 경우 사용하고, 숫자일 경우 생략

value - range - set(s): 값과 범위를 지정.

 

 

36. Which one of the following SAS programs uses the most amount of memory resources for output buffers?

A.

data new(bufsize = 1000 bufno = 5);
    set temp;
run;

B.

data new(bufsize = 1000 bufno = 2);
    set temp;
run;

 

C.

data new(bufsize = 2000 bufno = 3);
    set temp;
run;

D.

 

data new(bufsize 4000 bufno = 1);
    set temp;
run;

[정답] c

[풀이]

SAS 데이터 라이브러리가 순차적으로 처리될 때 I/O 전송단위(바이트)는 BUFSIZE * BUFNO와 같습니다.

그러므로 A는 5000, B)2000, C) 6000, D)4000입니다.

가장 많은 메모리 차지하는 C가 정답이 됩니다.

 

 

#37.

Given the following SAS data sets ONE and TWO:

 

ONE 

NUM CHAR1 

1   A1 

1   A2 

2   B1 

2   B2 

5   V

 

TWO 

NUM CHAR2

2   X1

2   X2 

3   Y

4   D

 

The following SAS program is submitted creating the output table THREE:

 

proc sql;

    create table three 

    as select one.num, char1, char2 from one, two 

    where one.num = two.num;

quit;

 

THREE 

NUM CHAR1 CHAR2

2   B1    X1

2   B1    X2

2   B2    X1

2   B2    X2

 

Which one of the following DATA step programs creates an equivalent SAS data set THREE?

A.

 

data three;
    merge one two;
    by num;
run;

 

B.

data three;
    set one;
    set two;
    by num;
run;

merge one two;
    by num;
run;

C.

data three;
    set one;
    set two;
    by num;
run;

 

D.

data three;
    set one;
    do i = 1 to numobs;
        set two(rename = (num = num2)) point = i nobs = numobs;
        if num2 = num then output;
    end;
    drop num2;
run; 

 

[정답] D

[풀이]

set은 둘 이상의 데이터셋을 세로로 결합하는 명령문입니다.

결합되는 순서는 set 문장에서 나온 순으로 결합됩니다.

칼럼명이 일치 하지 않은경우 rename 옵션을 사용하여 num을 num2로 변경하여 결합하였습니다.

 

'nobs=' 옵션은 데이터셋에 있는 관측 수를 임시변수에 할당합니다.

D)를 보면 nobs옵션을 사용하여  numobs변수라는 임시변수에 관측수 값을 할당하였습니다.

'point=' 옵션은  임시변수를 지정하는데 , 이 임시변수의 숫자 값은 어떤 관측치를 읽을 것인지를 결정합니다.

 

Contributors
Version history
Last update:
‎11-22-2020 08:46 PM
Updated by:

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Article Labels
Article Tags