EZ Study

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

SAS Programing Certification Exam
Practice Questions & Answer set-2

Practice Question 6

The following SAS program is submitted:

data work.company;
set work.dept1(keep = jobcode) work.dept2(rename = (jcode = jobcode));
Click to Get Those Highly Recommended SAS Programmers' Books
run;

Which one of the following is the result?

A. The variable JCODE is written to the output data set.
B. The variable JOBCODE is written to the output data set.
C. Neither variable JCODE nor JOBCODE is written to the output data set.
D. The program fails to execute due to errors.

Answer: B

Practice Question 7

The following SAS program is submitted:

data work.passengers;
if OrigPassengers = . then OrigPassengers = 100;
TransPassengers = 100;
OrigPassengers = .;
NonPaying = 10;
TotalPassengers = sum (OrigPassengers, TransPassengers);
run;

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

A. 100     B. 110     C. 200     D. . (missing numeric value)

Answer: A; Sum function ignores missing value

Practice Question 8

The following SAS program is submitted:
data work.passengers;
if OrigPassengers = . then OrigPassengers = 100;

TransPassengers = 100;
OrigPassengers = .;
NonPaying = 10;
TotalPassengers = OrigPassengers + TransPassengers;
run;

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

A. 100     B. 110     C. 200     D. . (missing numeric value)

Answer: D ; In an assignment statement, if one of the values is missing then the value assigned to is set to missin

Practice Question 9

The following SAS program is submitted:

data work.staff;
JobCategory = 'FA';
JobLevel = '1';
JobCategory = JobCategory || JobLevel;
run;

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

A. FA     B. FA1     C. FA 1     D. ' ' (missing character value)

Answer: A ; When SAS sees the JOBCATEGORY for the first time it sets the length to 2 characters. The concatenated 'FA1' gets truncated to 'FA' becoz of the length

Practice Question 10

The following SAS program is submitted:

data work.one;
x = 3;     y = 2;     z = x ** y;
run;

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

A. 6     B. 9     C. . (missing numeric value)
D. The program fails to execute due to errors.

Answer: B ; Z=3**2 is 3 to the power of 2 i.e.

Related links:

Continue to SAS Practice Exam Question Answer Set-3   SAS interview Questions Answers
Back to SAS Practice Exam Question Answer Set-1   SAS Tutorial   Statistics Tutorial