BookmarkSubscribeRSS Feed

SAS Certified Advanced Programmer 덤프2 풀이 1-3

Started ‎06-29-2020 by
Modified ‎06-29-2020 by
Views 809

1. The following SAS program is submitted:

Data sasuser.history;

Set sasuser.history(keep=state x y

Rename = (state=ST));

Total=sum(x,y);

Run;

 

The SAS data set SASUSER.HISTORY has an index on the variable STATE. Which describes the result of submitting the SAS program?

 

A. The index on STATE is deleted and an index on ST is created B.The index on STATE is recreated as an index on ST

C.The index on STATE is deleted

D.The index on STATE is updated as an index on ST 

 

Answer: C       

[풀이]

+)Index?

대량의 SAS 데이터셋은 순차적으로 자료를 읽습니다. (sequential access)

순차적으로 자료를 읽는 과정을 피하고자 특정 관측치를 직접 찾기 위해서 인덱스를 사용합니다.(direct access)

*INDEX의 옵션들

WHERE statement: 데이터의 한 부분집합에서 더 빠르고 효율적인 접근을 제공합니다. (=작은 subset에 더 빠르게 접근하는 경우)

BY: SORT 절차를 사용하지 않고도인덱스는 인덱스 순서로 관측치들을 돌려줍니다.

SET 문 & MODIFY :  ‘KEY = ‘ 옵션 DATA 단락에서 인덱스를 지정하여 한 데이터 파일에서 특정한 관측들을 검색할 수 있게 해줍니다.

 

이 문제는 INDEX를 사용하였을 때, RENAME을 한 기존의 변수가 어떻게 처리되는지를 묻는 문제입니다.

INDEX에서 RENAME을 사용하면 기존의 인덱스는 사라집니다.

 

2. The following SAS program is submitted:

%macro one(input);

%two;

%put the value is &date;

%mend;

%macro two;

data _null_;

call symput('date','12SEP2008');

run;

%mend;

%let date=31DEC2006;

%one(&date)

 

What is the result when the %PUT statement executes.?

A. A macro variable DATE with the value 12SEP2008 is retrieved from the local symbol

table for the ONE macro

B. A macro variable DATE with the value 12SEP2008 is retrieved from the local symbol

table for the TWO macro

C. A macro variable DATE with the value 12SEP2008 is retrieved from the global

symbol table

D. A macro variable DATE with the value 31DEC2006 is retrieved from the global

symbol table

 

Answer: C

 

[풀이]

 

Global Symbol Table 에서의 Macro Variables

  • SAS 세션이 시작할 때 초기화됩니다.
  • Automatic or System-defined Macro Variables 가 초기화 됩니다.
  • SAS 세션이 끝날 때 delete 됩니다.

Global Macro Variable 를 생성하려면

  • %LET 문장(used outside a macro definition)
  • DATA step 에서의 CALL SYMPUT 사용
  • PROC SQL 의 INTO 절
  • %GLOBAL 문장

매크로에서는 변수의 이름에는 ‘&’가 붙고 매크로 이름에는 %가 붙습니다.

CALL SYMPUT(“저장할 매크로 이름”, 값);

이와 반대로 LOCAL SYMBOL TABLE이 있으며, 매크로 문장 내에서 parameter list를 지정했을 때나, 매크로 실행동안 생성되며, 매크로 실행이 끝나면 삭제됩니다.

이 문제에서는 CALL SYMPUT을 사용했으므로 GLOBAL SYMBOL TABLE에 저장됩니다.

 

 

 

 

3. Which SET statements option names a variable that contains the number of the observation to read during the current iteration of the DATA step?

a.OBS=pointobs

b.POINT=pointobs

c.KEY=pointobs

d.NOBS=pointobs

 

[정답]B

[풀이]

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

그래서, 번호(숫자)값을 갖는 pointobs라는 임시변수를 생성할 수 있습니다.

OBS옵션 = N: N번째 개체까지만 데이터를 불러옵니다.

KEY옵션 =: SET 구문 옵션과 같이 사용되며, SAS데이터 세트의 관측치에 대하여 비순차적 접근 방식으로 접근합니다.

NOBS=variable: 데이터세트에 대한 관측치의 총 개수가 저장되는 임시 변수를 생성합니다. 다수 데이터세트가 나열되면, NOBS=는 데이터 세트에 나열된 관측치의 총 개수를 저장합니다. 관측치의 개수에는 삭제를 위하여 표시되었으나 아직 실질적으로 삭제되지 않은 관측치도 포함됩니다.

 

* 덤프2번째 파일을 첨부하였습니다. 

Comments

유용한 자료 감사합니다. 

Version history
Last update:
‎06-29-2020 01:02 PM
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