BookmarkSubscribeRSS Feed

SAS Certified Advanced Programmer 덤프2 풀이 19-20

Started ‎07-31-2020 by
Modified ‎07-31-2020 by
Views 1,204

 

19.The following SAS program is submitted: 

 

%let a=cat;  /*매크로a가 cat으로 출력되는 매크로 생성*/

%macro animal(a=frog); /*a변수 값은 frog로 가지는 animal 매크로*/

%let a=bird; 

%mend; /*매크로 종료*/

%animal(a=pig) 

%put a is &a;

 

What is written to the SAS log? 

 

A. a is pig 

B. a is cat 

C. a is frog 

D. a is bird 

 

*pdf파일에는 B.a set cat이라고 나와있으나 a is cat으로 수정해서 문제를 풀어주세요

 

[정답]B

[풀이]

Global macro로 a에는 cat이 할당되어 있습니다.

Local macro에는 frog가 할당되어 있습니다.

 

%animal(a=pig)로 local 매크로 호출이 끝나고 Global 매크로 호출로 sas log에는 a is cat이 작성됩니다. 

 

 

20.Which SQL procedure program deletes rows from the data set CLASS?

 

 A. proc sql; 

    Select * from class 

    Where age<(select stop_age from threshold);

    Quit;

 

B. proc sql; 

   Modify table class Delete 

   where age<(select stop_age from threshold);

   Quit;

 

 

C. proc sql; 

   Delete from class 

   Where age<(select stop_age from threshold); 

   Quit;

 

D. proc sql; 

   Alter from class Delete 

   where age<(select stop_age from threshold); 

   Quit;

 

[정답] C

[풀이]

proc sql을 이용해서 테이블 또는 view에서 add,modify, delete rows , 테이블의 칼럼 속성 바꾸기, 칼럼을 add 또는 drop가능

 

C)PROC SQL에서 DELETE문을 사용하면, WHERE구문에 속한 특정 rows를 삭제한다. 

 

D) PROC SQL에서 ALTER문을 사용하면, 테이블의 확장, 테이블 축소, 기존 테이블의 컬럼 속성 변경이 가능.

 

11.JPG

 

Comments

Hi:

  I'm not sure what your question is. Is this from the Practice Exam? You should be able to understand why the correct answer is the correct answer by referring back to the Prep Guide or the documentation or the training classes.

 

  The first question could easily have been checked by running the original program and perhaps inserting some extra %PUT statements into the program, as shown below:

Cynthia_sas_0-1596298207495.png

In order to answer this question correctly, you had to understand the fundamental concept of GLOBAL and LOCAL symbol tables. By running the program in question, you can see that the GLOBAL macro variable A was unchanged by anything in the Macro program definition. That's because the Macro program, when invoked, creates a separate LOCAL symbol table that does NOT impact the GLOBAL table. And you have to understand that the LOCAL symbol tables go away when the Macro program execution ends. So the GLOBAL value of macro variable A was set to cat and it was unchanged by the Macro program execution. At the final %PUT, the only macro variable A that was existing was the GLOBAL macro variable.

 

  You should be able to figure out why C is the correct answer for the second question. If you run the code after making some test data, you will see the difference between the choices.

 

Hope this helps,

Cynthia

Hi @Cynthia_sas,

this is HB from SAS Korea.

As a part of SAS Korea community page promotion, Amee is posting dummy question and solutions for SAS Certification exam. So, it's okay not to add comments on her posts 🙂

 

Thanks!

 

Version history
Last update:
‎07-31-2020 11:07 PM
Updated by:
Contributors

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Article Labels
Article Tags