SAS Base, A00-211 Crambible,

SAS 크램바이블 SAS 베이스 자격증, SAS 문제풀이


QUESTION NO: 152

The following SAS program is submitted:


data work.test;
First = 'Ipswich, England';
City_Country = substr(First,1,7)!!', '!!'England'; 

run;


Which one of the following is the length of the variable CITY_COUNTRY in the output data set?


A. 6 

B. 7 

C. 17 

D. 25



|| 와 !! 는 문자를 연결해주는 역할을 합니다. 

Ipswich, England = 16, 

',(공백)' = 2 

England = 7 




Answer: D 













QUESTION NO: 153

The following SAS program is submitted: 


data work.test;
First = 'Ipswich, England';
City = substr(First,1,7);

City_Country = City!!', '!!'England'; 
run;

Which one of the following is the value of the variable CITY_COUNTRY in the output data set?


A. Ipswich!!
B. Ipswich, England 

C. Ipswich, 'England' 

D. Ipswich , England




참고로 city변수는 first의 변수와 length가 16으로 같습니다. city의 값은 first 변수의 첫번째 덩어리가 되는거죠. 그래서 Ipswich_________ (뒤에는 공백 9칸) 값이 됩니다. 그리고 쉼표로 구분되어지고 다시 England가 붙게 되어요. 


만약 C처럼 표현하고 싶으면 trim 기능을 이용해야합니다. 


City_Country = City!!', '!!'England' -> "Ipswich_________, England"

City_Country = TRIM(City)!!', '!!'England' -> "Ipswich, England"





Answer: D 



반응형

+ Recent posts