65. The variable attributes of SAS data sets ONE and TWO are shown below:
Data set ONE contains 100 observations. Data set TWO contains 50 observations. Both data sets are sorted by the variable YEAR.
The following SAS program is submitted:
data three;
merge one two;
by year;
run;
A. No messages are written to the SAS log.
B. ERROR and WARNING messages are written to the SAS log.
C. Data set THREE is created with two variables and 50 observations.
D. Data set THREE is created with three variables and 100 observations.
[정답] B
[풀이]
Merge는 단순 가로대응결합으로 data set의 공통변수의 값을 기준으로 행 병합을 합니다.
Mergeansdp dlTsms 각 입력 데이터세트는 BY문장의 변수를 기준으로 정렬합니다.
문제에서는 변수명이 아니라 값(year)로 기준을 삼아서 에러문이 뜹니다.
[코드]
[올바른코드]
[결과값]
data new (bufsize = 6144 bufno = 4);
set old;
run;
Which one of the following describes the difference between the usage of BUFSIZE= and BUFNO= options?
A. BUFSIZE= specifies the size of the input buffer in bytes; BUFNO= specifies the number of input buffers.
B. BUFSIZE= specifies the size of the output buffer in bytes; BUFNO= specifies the number of output buffers.
C. BUFSIZE= specifies the size of the output buffer in kilobytes; BUFNO= specifies the number of input buffers.
D. BUFSIZE= specifies the size of the output buffer in kilobytes; BUFNO= specifies the number of output buffers.
[정답] B
[풀이]
BUFSIZE는 출력 버퍼의 크기를 바이트 단위로 지정합니다.
BUFNO는 출력 버퍼 수를 지정합니다.
%macro one;
data _null_;
call symput('proc','means');
run;
proc &proc data=sashelp.class;
run;
%mend;
%one
What is the result?
A. The marco variable PRCO is stored in the SAS catalog WORK.SASMACR
B. The program fails to execute because PROC is a reserved word
C. The macro variable PROC is stored in the local symbol table
D. The macro variable PROC is stored in the global symbol table
[정답]D
[풀이]
Global Symbol Table 에서의 Macro Variables
Global Macro Variable 를 생성하려면
매크로에서는 변수의 이름에는 ‘&’가 붙고 매크로 이름에는 %가 붙습니다.
CALL SYMPUT(“저장할 매크로 이름”, 값);
이와 반대로 LOCAL SYMBOL TABLE이 있으며, 매크로 문장 내에서 parameter list를 지정했을 때나, 매크로 실행동안 생성되며, 매크로 실행이 끝나면 삭제됩니다.
[코드]
[결과]
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.