SAS Base, A00-211 Crambible 

SAS 베이스 자격증 


QUESTION NO: 37

Given the raw data file YEARAMT: 

----|---10---|---20---|----30 

year quantity 

1901 2 

1905 1 

1910 6 

1925 . 

1941 1

The following SAS program is submitted:


data coins;

infile 'yearamt';
input year quantity;
<insert statement(s) here>
run;


Which statement(s) completed the program and produced a non-missing value for the variable TOTQUANTITY in the final observation of the output data set?


A. totquantity + quantity;
B. totquantity = sum(totquantity + quantity);
C. retaintotquantity; totquantity = totquantity + quantity; 

D. retain totquantity0;totquantity = totquantity + quantity;


'yearamt'라는 raw 데이터를 가지고 coins 데이터를 만드려고 하는데요. 이때  year 와 quantity의 변수를 갖도록 하려고 합니다. 질문은, TOTQUANTITY의 마지막 observation이 missing value가 되지 않으려면 어떻게 해야할까요..란 질문입니다. 

 


A : totquantity + quantity;

 - totquantity라는 변수가 그전에 정의되지 않았기때문에 새롭게 만들고 missing value로 지정이 됩니다. 그리고 이렇게 statement로 두개의 변수끼리 +로 이뤄지면, quantity를 추가적으로 누적하게 됩니다. 


B: totquantity = sum(totquantity + quantity);

 - sum 의 함수 모습은 sum(a,b) 의 형태로 되어야합니다. 참고로 sum(a,b) 경우 missing value를 무시해서 계산되어집니다. totquantigy는 그 전에 값이 지정되어있지 않아서 missing value로 지정이 되었고요. totquantigy + quantigy 경우 operator로 의한 연산이 됩니다. 그래서 결과는 missing value가 되겠죠. sum (missing value)는 결국 전체가 missing valuer가 됩니다. 

 

 

C : retain totquantity; 

     totquantity = totquantity + quantity;

 - 이때 retain에서 totquantity의 값을 missing value로 할당했습니다. 그 후 + 에 대한 연산이 missing value를 처리할 수 없어 결과물은 결국 missing value가 됩니다. 


D : retain totquantity 0; 

     totquantity = totquantity + quantity;

 - totquantity값을 0 으로 지정하였고요. 하지만 quantity에 missing value가 있기때문에 연산처리를 할 수 없어서 답이 아니게 됩니다. 그러니까 2, 3, 9 이런식으로 계산되다가 quantity 중간에 missing value가 들어있어서 결국 마지막 observation은 missing value가 됩니다. 


Answer: A 



반응형

SAS Base, A00-211 Crambible 

SAS 베이스 자격증 



QUESTION NO: 36


The value 110700 is stored in a numeric variable named SALARY.

 

Which FORMAT statement displays the value as $110,700.00 in a report?


A. format salary comma11.2;
B. format salary dollar8.2;
C. format salary dollar11.2;
D. format salary comma8.2 dollar8.2;




110700을 $110,700.00 라고 표현하려고 합니다. dollar 표시가 있어야하니 B 아니면 C 가 답이겠지요. 


.(period) 을 기준으로 앞 부분은 전체 자리고요 뒤 기준은 소숫점 자리수입니다. 

참고로 dollar 및 , 도 자리를 표시합니다. 


Answer: C 



반응형

SAS Base, A00-211 Crambible 

SAS 베이스 자격증 

QUESTION NO 35


The following SAS program is submitted:


proc freq data = class;

tables gender * age / <insert option here>

run;

The following report is created:

The FREQ Procedure
Table of gender by age

Row Column

Gender age Frequency Percent Percent Percent 

F 11 1 10.00 20.00 50.00
12 2 20.00 40.00 40.00

13 2 20.00 40.00 66.67


Total 5 50.00 100.00  M 11 1 10.00 20.00 50.00 12 3 30.00 60.00 60,00 13 1 10.00 20.00 33.33


Total 5 50.00 100.00


Total 11 2 20.00 100.00 12 5 50.00 100.00 13 3 30.00 100.00 Total 10 100.00 


Which option correctly completes the program and creates the report?


A. LIST
B. NOCOLS
C. CROSSLIST
D. NOCROSSTAB


output이 제대로 정리된게 아니라서 자세한 설명은 패스합니다.


이원분할표를 만들고 싶으면 proc freq 을 사용하면 되는데요. 


proc freq data = class;

tables gender * age; 

run;

기본적으로 빈도, 백분률, 행백분율, 칼럼백분율 이렇게 생성 됩니다. 



proc freq data = class;

tables gender * age/list

run;

이처럼 옵션으로 list를 적용하게되면 list 형태로 빈도, 백분율, 누적빈도, 누적백분율이 나옵니다. 


proc freq data = class;

tables gender * age/nocol

run;

이원분할표 테이블로 나오는데요. 대신 빈도, 백분율, 행백분율이 나옵니다. 즉, no columns  칼럽백분율이 빠집니다. 


proc freq data = class;

tables gender * age/crosslist

run;

리스트형태로 보여주지만 단순 list에서, 각 카테고리별로, 그리도 그 최종합계도 또 나오게 됩니다. 


NOCROSSTAB 이건 없는 옵션입니다. 


Answer: C 


반응형

SAS Base, A00-211 Crambible 

SAS 베이스 자격증 


QUESTION NO: 34

The data set RALESTATE has the variable LOCALFEE with a format or 9. and a variable COUNTRYFEE with a format or 7.;


The following SAS program is submitted:


data history;

format local fee country fee percent6.; 

set realestate;
local fee = local fee / 100;
country fee = country fee / 100;

run;


What are the formats of the variables LOCALFEE and COUNTRYFEE in the output dataset?


A. LOCALFEE has format of 9. and COUNTRYFEE has a format of 7.
B. LOCALFEE has format of 9. and COUNTRYFEE has a format of percent6.
C. LOCALFEE has format of percent6. and COUNTRYFEE has a format of percent6. D. The data step fails execution; there is no format for LOCALFEE



RALESTATE라는 데이타엔, 9의 길이를 가지고 있는 LOCALFEE라는 변수와, 7의 길이를 가지고 있는 COUNTRYFEE 변수가 있습니다. 


history 데이타를 만들려고 하는데요. 이때 format이 percent6. 즉 퍼센트 여섯자리고 지정했습니다. 그리고 set으로 데이타를 읽어오는데요. realstate 데이타에는 이미 9와 7로 지정된 localfee와 coutryfee 변수가 있죠. 이때 어떤 format을 따르게되는지가 문제인데요. 


새롭게 정의된, 즉 format local fee country fee percent6.;  이 문장으로 정의된걸로 효력이 발생합니다.  


format은 어디에 있어도 효력이 발생하지만 length의 경우 data와 set 사이에 위치해야 효력이 발생한다는게 중요 포인트입니다. 



Answer: C 


반응형

SAS Base, A00-211 Crambible 

SAS 베이스 자격증 


QUESTION NO: 33 


following SAS program is submitted:


data temp.x

set sasuser.y; 

run;


What must be submitted prior to this SAS program for the program to execute successfully?


A. A LIBNAME statement for thelibref TEMP only must be submitted.
B. A LIBNAME statement for thelibref SASUSER only must be submitted.

C. LIBNAME statements for thelibrefs TEMP and SASUSER must be submitted. 

D. No LIBNAME statement needs to be submitted.



temp.x, temp라는 라이브러리에 x 라는 데이터를 만들려고 합니다. set을 통해 영구 library에 있는 y를 가져오려고 합니다. 이때 temp라는 라이브러리가 사전에 정의되어야합니다. 반 SASUSER 는 SAS안에있는 라이브러리여서 default로 y라는 파일만 있으면 오류가 생기지 않습니다. 


Answer: A 


반응형

+ Recent posts