BookmarkSubscribeRSS Feed

SAS Certified Advanced Programmer 덤프 풀이 80-82

Started ‎06-23-2020 by
Modified ‎06-23-2020 by
Views 347

SAS Certified Advanced Programmer 덤프 풀이 80-82

 

 

  1. The following SAS program is submitted:

options yearcutoff = 1950;

%macro y2kopt(date);

%if &date >= 14610 %then %do;

options yearcutoff = 2000;

%end;

%else %do;

                   options yearcutoff = 1900;

%end;

%mend;

data _null_ ;

date = "01jan2000"d;

call symput("date", left(date));

run;

%y2kopt(&date)

The SAS date for January 1, 2000 is 14610 and the SAS system option for YEARCUTOFF is set to 1920 prior to submitting the above program.

Which one of the following is the value of YEARCUTOFF when the macro finishes execution?

 

A. 1900

B. 1920

C. 1950

D. 2000

 

 

[정답] D

[풀이]

yearcutoff : 두자리 연도의 범위를 설정 (default 1920)

  1. ex) yearcutoff=1920일 경우, 1920 ~ 2019의 범위로 인식
  2. ‘41.03.26 인 경우 : 1941.03.26
  3. ‘15.05.31 인 경우 : 2015.05.31
  4. ‘21.11.12 인 경우 : 1921.11.12

 

Macro 조건문 %IF %THEN

[문법]

SAS코리아_0-1592903988995.png

 

January 1, 200014610되어있습니다. 그래서 매크로 조건문에 맞게 YEARCUTOFF 2000으로 실행됩니다.

  1. Given the following SAS data set ONE:

ONE

LEVEL AGE

------------

1 10

2 20

3 20

2 10

1 10

2 30

3 10

2 20

3 30

1 10

The following SAS program is submitted:

proc sql;

select level, max(age) as MAX

from one

group by

level having max(age) > (select avg(age) from one);

quit;

Which one of the following reports is generated?

 

A

LEVEL AGE

-----------

2 20

3 20

 

B

LEVEL AGE

-----------

2 30

3 30

 

C

LEVEL AGE

-----------

2 20

3 30

 

D

LEVEL AGE

-----------

2 30

3 30

 

[정답] D

[풀이]

Proc sql문을 사용해서 sql 문법이해가 필요합니다.

Select: 결과 테이블에 원하는 변수만 선택합니다. As 문을 사용해서 max(age)MAX라는 변수를 만들었습니다.

From: 참조하는 테이블

Group by: level 변수를 기준으로 같은 데이터 값끼리 그룹화합니다.

Having: 요약된 테이블에 조건을 거는 함수입니다.

LEVEL

AVG(AGE)

MAX(AGE)

1

10

10

2

20

30

3

20

30

 

AVG(AGE)보다 MAX(AGE)가 큰 조건(GROUP BY) LEVEL 2,3입니다.

SAS코리아_1-1592903988996.png

 

 

  1. Which one of the following is true regarding the KEEP statement?

A. The KEEP statement is available in both the DATA and the PROC steps.

B. The KEEP statement selects the variables read from the input data set(s).

C. The KEEP statement applies to all data sets created within the same DATA step.

D. The KEEP statement applies only to the first data set created within the same DATA step if more than one data set is created.

 

[정답] C

[풀이]

keep문은 결과 데이터셋에서 남기고 싶은 변수를 선택하는 함수입니다.

문법은 ‘KEEP Variable-list;’입니다. Variable-list에 넣은 변수를 제외하고는 제거합니다.

SAS코리아_2-1592903988998.png

 

KEEP문을 첫 문장에 사용해도 keep문장의 효과를 얻을 수 있습니다.

 

 

 

Version history
Last update:
‎06-23-2020 05:48 AM
Updated by:
Contributors

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Article Labels
Article Tags