EZ Study

Actuarial Biology Chemistry Economics Calculators Confucius Engineer
Physics
C.S.

SAS Programing Certification Exam
Practice Questions & Answer set-27

Practice Question 133

The following SAS program is submitted:
data work.test;
First = 'Ipswich, England';
City = substr(First,1,7);
Click to Get Those Highly Recommended SAS Programmers' Books
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


Answer is D. Subtri will have the same length as the orignal variable.

Practice Question 134

The following SAS program is submitted:
data work.retail;
cost = '20000';
total = .10 * cost;
run;
Which one of the following is the value of the variable TOTAL in the output data set?
A. 2000   B. '2000'   C. . (missing numeric value)   D. ' ' (missing character value)


Answer is A. Automatica conversion.

Practice Question 135

Which one of the following SAS statements correctly computes the average of four numerical values?
A. average = mean(num1 - num4);   B. average = mean(of num1 - num4);
C. average = mean(of num1 to num4);   D. average = mean(num1 num2 num3 num4);


Answer is 'B'.

Practice Question 136

The following SAS program is submitted:
data work.test;
Author = 'Christie, Agatha';
First = substr(scan(author,2,' ,'),1,1);
run;
Which one of the following is the value of the variable FIRST in the output data set?
A. A   B. C   C. Agatha   D. ' ' (missing character value)


Answer is 'A'.

Practice Question 137

The following SAS program is submitted:
data work.test;
Title = 'A Tale of Two Cities, Charles J. Dickens';

Word = scan(title,3,' ,');
run;
Which one of the following is the value of the variable WORD in the output data set?
A. T
B. of
C. Dickens
D. ' ' (missing character value)


Answer is B. Be very careful about the space right before the comma! It tells you the blank is also a delimiter. If there is no space right before the comma, then the answer should be D.

Practice Question 138

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


Answer is D. The lenght of variable First=16, so it's the length of this partial variable: substr(First,1,7)!

Related links:

Continue to SAS Practice Exam Question Answer Set-28   SAS interview Questions Answers
Back to SAS Practice Exam Question Answer Set-26   SAS Tutorial   Statistics Tutorial