BookmarkSubscribeRSS Feed

SAS Certified Advanced Programmer 덤프2 풀이 16-18

Started ‎07-14-2020 by
Modified ‎07-14-2020 by
Views 497

16.The following SAS program is submitted: 

 

%macro check(num=4); 

%let result=%sysevalf(&num+0.5); 

%put result is &result; 

%mend; 

%check(num=10) 

 

What is the written to the SAS log?

 

A. result is 

B. result is 10.5 

C. result is 10+0.5 

D. result is 10

 

[정답]B

[풀이]

SAS Macro는 모든 값이 문자형으로 저장됩니다. 숫자형으로 입력을 하더라도 문자형으로 저장됩니다. 

하지만 문자형으로 인식하지만 연삭식을 사용하는 경우 연산이 가능합니다.

macro에서 numeric형의 값에 어떤 계산을 하고자 할 때는 %eval이라는 function을 사용해서 계산이 가능합니다.

소수점 자리까지 계산이 필요하다면 %sysevalf function을 사용.

 

num값에 10을 입력하고 0.5를 더하는 메크로를 사용하여 정답은 B입니다.

 

 

17.Given the SAS data set ONE: 

 

ONE 

DIVISION SALES 

A 1234

A 3654

B 5678 

 

The following SAS program is submitted:

 

Data_null_;

Set one;

By divition; 

If first.division then

Do; 

%let mfirst=sales;

end; 

run; 

 

What is the value of the macro variable MFRIST when the program finishes execution? 

 

A. 1234 

B. sales 

C. 5678

D. null 

 

[정답]B

[풀이]

IF - THEN DO: THEN 뒤에 실행한 조건문이 두 개 이상일 경우 THEN DO 문장을 사용합니다.

*문법

IF condition THEN DO;

     statement;

END;

ELSE IF condition THEN DO;

     statement;

END;

    .....

ELSE DO;

     statement;

END;

 

 

%LET XXX=YYY : 매크로 XXX가 YYY로 출력되는 매크로를 생성합니다.

->%let mfirst=sales; /*mfirst가 sales로 출력되는 매크로 생성*/

그러므로 정답은 B.sales가 됩니다.

 

 

18.The following SAS program is submitted: 

 

%let first=yourname; 

%let last=first;

%put &&&last; 

 

What is written to the SAS Log? 

 

A. First 

B. Yourname 

C. &&First 

D. &yourname

 

[정답]B

[풀이]

 

%LET xxx=yyy: 매크로 xxx가 yyy로 출력되는 매크로 생성

%PUT명령어는 매크로 칼럼과 결과값을 로그창에 확인 가능.

 

%put &&&last; 

-> forward re scan rule로 매크로 프로레스에서 &&를 &로 인식합니다.

  (&&)(&)last 

 = & & last

 =(& &)last

 = &last 

 

-> &last : 매크로 last를 출력

-> 매크로 last -> first 출력

-> 매크로 first -> yourname 출력

Version history
Last update:
‎07-14-2020 11:52 AM
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