EZ Study

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

SAS Programing Certification Exam
Practice Questions & Answer set-3

### Practice Question 11

The SAS data set named WORK.TEST is listed below:

capacity airplanetype staff
150 Large 10

Which one of the following SAS programs created this data set?

A. data work.test;
capacity = 150;
if 100 le capacity le 200 then airplanetype = 'Large' and staff = 10;

else airplanetype = 'Small' and staff = 5;
run;

B. data work.test;
capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large';
staff = 10;
end;
else do;
airplanetype = 'Small';
staff = 5;
end;
run;

C. data work.test;
capacity = 150;
if 100 le capacity le 200 then do;
airplanetype = 'Large';
staff = 10;
else do;
airplanetype = 'Small';
staff = 5;
end;
run;

D. data work.test;
capacity = 150;
if 100 le capacity le 200 then;
airplanetype = 'Small';
staff = 5;
else;
airplanetype = 'Large';
staff = 10;
run;

Answer: B Tricky one.all look similar.check for the syntax for do;end;

### Practice Question 12

The following SAS program is submitted:

data work.flights;
destination = 'cph';
select(destination);
when('LHR') city = 'London';
Click to Get Those Highly Recommended SAS Programmers' Books
when('CPH') city = 'Copenhagen';
otherwise city = 'Other';
end;     run;

Which one of the following is the value of the CITY variable?
A. Other     B. Copenh     C. Copenhagen     D. ' ' (missing character value)

Answer: A SAS variable are NOT case-sensitive but the DATA IS.

### Practice Question 13

The following SAS program is submitted:

data work.flights;
destination = 'CPH';
select(destination);
when('LHR') city = 'London';
when('CPH') city = 'Copenhagen';
otherwise;     end;     run;

Which one of the following is the value of the CITY variable?

A. London     B. Copenh     C. Copenhagen     D. ' ' (missing character value)

Answer: B When SAS sees the DESTINATION for the first time i.e. 'London' it sets the length to 6 characters. Therefore the value 'Copenh' is assigned to DESTINATION becoz of the length.

Related links:

Continue to SAS Practice Exam Question Answer Set-4   SAS interview Questions Answers
Back to SAS Practice Exam Question Answer Set-2   SAS Tutorial   Statistics Tutorial