BookmarkSubscribeRSS Feed

SAS Certified Advanced Programmer 덤프3 풀이 20-22

Started ‎09-15-2020 by
Modified ‎09-15-2020 by
Views 806

20. The following SAS program is submitted: 

 

%let value = 9; 
%let value2 = 5; 
%let newval = %eval(&value/ &value2);  

Which one of the following is the resulting value of the macro variable NEWVAL?


A. 1
B. 2
C. 1.8
D. null

 

[정답]A

[풀이]

*sas macro

%let xxx=yyy; : 매크로 xxx가 yyy로 출력되는 매크로 생성.

%eval(expression) : %eval함수는 수리나 논리적 연산 수행, 소수점 자리까지 포함된 값은 계산을 못하는 단점. (소수점까지 계산이 필요한다면 %syseval로 값을 계산할 수 있다.)

&xxx :매크로 xxx를 출력한다.

 

 

21. The following SAS program is submitted:

%let lib = %upcase(sasuser);
proc sql;
    select nvar from dictionary.tables
        where libname = "&lib";
quit;

Given that several SAS data sets exist in the SASUSER library, which one of the following is generated as output?

A. no result set
B. a syntax error in the log
C. a report showing the names of each table in SASUSER
D. a report showing the number of columns in each table in SASUSER

 

[정답]D

[풀이]

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

%UPCASE(string):문자열을 대문자로 변환하는 함수

&xxx :매크로 xxx를 출력한다.  /*upcase로 sasuser이 SASUSER로 바뀌고 매크로 &lib으로 SASUSER을 호출하였다. 그러므로, 정답은 D가 된다. 

 

22. Given the following SAS data set ONE:

 

ONE 
GROUP SUM
A     765
B     123
C     564

The following SAS program is submitted:

 

data _null_;
    set one; 
    call symput(group,sum);
run;

Which one of the following is the result when the program finishes execution?

A. Macro variable C has a value of 564.
B. Macro variable C has a value of 1452.
C. Macro variable GROUP has a value of 564.
D. Macro variable GROUP has a value of 1452.

 

[정답]A

[풀이]

CALL SYMPUT("macro-variable",value);

CALL SYMPUT은 DATA step에서 value에 지정된 값을 macro-variable에 저장한 후, 다른 프로시저나 실행문에서 사용할 수 있도록 해줍니다.

​주의할 점은 CALL SYMPUT 사용하여 만든 매크로 변수는 생성하였던 DATA step과 동일한 DATA step에서는 사용될 수 없습니다.

 

B는 1452값이 없습니다.

Group값은 A,B,C의 값만 있어서 C,D는 정답이 아닙니다.

 

Version history
Last update:
‎09-15-2020 09:04 AM
Updated by:
Contributors

sas-innovate-white.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.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Article Labels
Article Tags