EZ Study

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

SAS Programing Certification Exam
Practice Questions & Answer set-30

Practice Question 147

The following SAS DATA step is submitted:
data work.accounting;
set work.department;
length jobcode $ 12;
run;
The WORK.DEPARTMENT SAS data set contains a character variable named JOBCODE
Click to Get Those Highly Recommended SAS Programmers' Books
with a length of 5.Which one of the following is the length of the variable JOBCODE in the output data set?
A.   B. 8   C. 12
D. The length can not be determined as the program fails to execute due to errors.


Answer is A. If the "length statement" would have been defined before "set statement", then the answer would be C!

Practice Question 148

Which one of the following SAS statements renames two variables?
A. set work.dept1
work.dept2(rename = (jcode = jobcode)   (sal = salary));
B. set work.dept1
work.dept2(rename = (jcode = jobcode   sal = salary));
C. set work.dept1
work.dept2(rename = jcode = jobcode   sal = salary);
D. set work.dept1
work.dept2(rename = (jcode jobcode)   (sal salary));


Answer is B.

Practice Question 149

The following SAS program is submitted:
data work.company;
set work.dept1(keep = jobcode)

work.dept2(rename = (jcode = jobcode));
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 is B. The variable jcode in the second dataset is renamed as JOBCODE and since there is no BY variable specified, the datasets are simply appended one on top without any overwriting!!!

Practice Question 150

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 is A

Practice Question 151

The following SAS program is submitted:data work.passengers;
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 is D.

Related links:

Continue to SAS Practice Exam Question Answer Set-31   SAS interview Questions Answers
Back to SAS Practice Exam Question Answer Set-29   SAS Tutorial   Statistics Tutorial