BookmarkSubscribeRSS Feed

SAS Certified Advanced Programmer 덤프3 풀이 17-19

Started ‎09-10-2020 by
Modified ‎09-10-2020 by
Views 434

No.17 Given the following SAS data set ONE: 

 

[ONE] 

NUM  VAR
1        A 

2        B 

3        C 

 

Which one of the following SQL programs deletes the SAS data set ONE?

A. 

proc sql; 

delete table one; 

quit;


B. 

proc sql; 

alter table one drop num, var; 

quit;

C. 

proc sql; 

drop table one; 

quit;

D. 

proc sql; 

delete from one; 

quit;

 

[정답]C

[풀이]

proc sql의 drop문은 사용자가 지정한 테이블/뷰 테이블/인덱스등을 삭제한다.

proc sql의 alter table구문은 기존 테이블의 구조를 변경하는 구문으로 테이블에 존재하는 열을 대상으로 추가, 수정, 삭제 및 열의 속성을 변경할 수 있으며, 기존 테이블에 무결성 제약조건을 생성, 수정, 삭제 등의 작업을 수행할 수 있다.

proc sql의 delete구문은 원하지 않는 rows를 테이블에서 제거가능

proc sql의 alter구문은 테이블의 확장(add), 테이블의 축소(drop,B.), 기존 테이블의 컬럼 속성변경(modify)할 수 있다.

 

 

No18. 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
where one.year = two.year; 
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 

 

[정답]C

[풀이]

proc sql;

 

select one.*, sales from one, two /*one테이블의 모든 변수 select, two테이블의 sales select*/
where one.year = two.year; /*조건: one 테이블의 year 변수와 two테이블의 year변수 값이 같은 것*/

 
*left join: 두개의 데이터셋에 조인키의 같은 값이 있는 경우 왼쪽 테이블을 기준으로 매치시켜 합치기
 
 
 

No19. The SAS data set TEMP has the following distribution of values for variable A: 

 

A      Frequency 

-------------------

1      500,000
2      500,000 

6      7,000,000
8      3,000 

 

Which one of the following SAS programs requires the least CPU time to be processed?
 

A. 

 

data new; 
set temp; 
if a = 8 then b = 'Small '; 
else if a in(1, 2) then b = 'Medium'; 
else if a = 6 then b ='Large'; run;

 

B. 

 

data new; 
set temp; 
if a in (1, 2) then b = 'Medium'; 
else if a = 8 then b = 'Small'; 
else if a = 6 then b ='Large'; run;

 

C. 

 

data new; 
set temp; 
if a = 6 then b = 'Large '; 
else if a in (1, 2) then b = 'Medium'; 
else if a = 8 then b ='Small';

 

D. 

 

data new; 
set temp; 
if a = 6 then b = 'Large ';
if a in (1, 2) then b = 'Small'; run;

 

 

[정답]C

[풀이]

효율적인 sas programming은 내림차순으로 코딩하도록 지시합니다.

if문을 사용해서 large -> medium -> small값 으로 내림차순으로 하는 것이 CPU시간을 작게합니다.

 

 

*sas certification prep guide 745-746참조

 

2.png

 

Version history
Last update:
‎09-10-2020 08:18 AM
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Article Labels
Article Tags