#14.
Consider the following SAS log:
229 data sasuser.ranch sasuser.condo / view = sasuser.ranch;
230 set sasuser.houses;
231 if style = 'RANCH' then output sasuser.ranch;
232 else if style = 'CONDO' then output sasuser.condo;
233 run; NOTE:
DATA STEP view saved on file SASUSER.RANCH. NOTE:
A stored DATA STEP view cannot run under a different operating system.
234
235 proc print data = sasuser.condo;
ERROR: File SASUSER.CONDO.DATA does not exist.
236 run; NOTE:
The SAS System stopped processing this step because of errors.
Which one of the following explains why the PRINT procedure fails?
A. SASUSER.CONDO is a stored DATA step program.
B. A SAS data file and SAS data view cannot be created in the same DATA step.
C. A second VIEW=SASUSER.CONDO option was omitted on the DATA statement.
D. The view SASUSER.RANCH must be processed before SASUSER.CONDO is created.
[정답] D
[풀이]
Views는 데이터가 저장되지는 않지만 저장된 프로그램을 담고 있는 데이터 파일의 일반화된 데이터베이스 개념입니다.
그러므로, View의 타입은 담고 있는 코드에 따라 결정됩니다.
View의 특징은 실제의 데이터는 담고 있지 않지만 데이터가 사용되는 순간에 추출하고 가장 최근에 사용한 데이터에 접근합니다. 그래서 사용자가 코드를 수정하는 것을 방지하는 특징이 있습니다.
view는 CONDO데이터 생성전에 실행되어야 하는데 CONDO데이터 생성 후 RANCH가 생성되었으므로, CONDO에는 데이터가 없습니다.
#15.
Which one of the following is an advantage of creating and using a SAS DATA step view?
A. It can store an index.
B. It always accesses the most current data.
C. It works quickly through multiple passes of the data.
D. It is useful when the underlying data file structure changes.
[정답]B
[풀이]
SAS Data Views는 데이터는 저장되지 않지만 저장된 프로그램을 담고 있는 데이터 파일의 일반화된 database 개념입니다. 따라서 View의 type은 담고 있는 코드에 따라 결정됩니다.
*View의 특징
- View는 SAS 코드가 저장됩니다.
- 실제의 데이터는 담고 있지 않습니다.
- 근본이 되는 데이터는 데이터가 사용되는 순간에 추출해내고, 가장 최근에 사용한 데이터에 접근합니다.
- 사용자가 코드를 수정하는 것을 방지합니다.
*View의 장점
- I/O를 줄입니다.
- 데이터 저장 공간을 줄입니다.
- 실제 시간을 줄이지만, CPU 시간을 줄이는 것은 아닙니다.
#16.
Given the following SAS data sets ONE and TWO:
ONE TWO
YEAR QTR BUDGET YEAR QTR SALES
2001 3 500 2001 4 300
2001 4 400 2002 1 600
2002 1 700
The following SAS program is submitted:
proc sql;
select one.*, sales from one, two;
quit;
Which one of the following reports is generated?
A. YEAR QTR BUDGET SALES
2001 4 400 300
2002 1 700 600
B. YEAR QTR BUDGET SALES
2001 3 500 .
2001 4 400 300
2002 1 700 600
C. YEAR QTR BUDGET SALES
2001 3 500 300
2001 4 400 300
2002 1 700 600
D. YEAR QTR BUDGET SALES
2001 3 500 300
2001 4 400 300
2002 1 700 300
2001 3 500 600
2001 4 400 600
2002 1 700 600
[정답]D
[풀이]
위는 CROSS JOIN으로 아무런 조건이나 제한사항 없이 양쪽을 있는 그대로 연결하는 결합입니다.
말 그대로 두개의 테으블을 그냥 붙였다는 개념입니다. 합집합(union)이라는 개념입니다.
그러므로 테이블 one의 모든 변수와 select함수로 sales변수의 합집합으로 정답은 D가 됩니다.
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.