EZ Study

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

SAS Programing Certification Exam
Practice Questions & Answer set-20

Practice Question 101

The following SAS program is submitted:
data test;
set sasuser.employees;
if 2 le years_service le 10 then
amount = 1000;
else if years_service gt 10 then
amount = 2000;
else
amount = 0;
amount_per_year = years_service / amount; run;
Which one of the following values does the variable AMOUNT_PER_YEAR contain if an employee has been with the company for one year?
A. 0   B. 1000   C. 2000   D. . (missing numeric value)

The Answer will be D as amount will be 0 and the per_year should be calculated only if amount ne 0. Asuming the variable name are valid.

Practice Question 102

The contents of the raw data file AMOUNT are listed below:
--------10-------20-------30
$1,234
The following SAS program is submitted:
data test;
infile 'amount';
input @1 salary 6.;
if _error_ then description = 'Problems';

else description = 'No Problems'; run;
Which one of the following is the value of the DESCRIPTION variable?
A. Problems   B. No Problems   C. ' ' (missing character value)
D. The value can not be determined as the program fails to execute due to errors.

The Answer will be A. as the program has an error which is compilation error so this will falg _ERROR_ to 1.

Practice Question 103

The contents of the raw data file NAMENUM are listed below:
--------10-------20-------30
Joe xx
The following SAS program is submitted:
data test;
infile 'namenum';
input name $ number;
run;
Which one of the following is the value of the NUMBER variable?
A. xx   B. Joe   C. . (missing numeric value)
D. The value can not be determined as the program fails to execute due to errors.

Answer is C, missing value, since a numeric value is expected for the variable been read, and a character value was found.

Practice Question 104

Which one of the following statements is true regarding the SAS automatic _ERROR_ variable?
A. The _ERROR_ variable contains the values 'ON' or 'OFF'.
B. The _ERROR_ variable contains the values 'TRUE' or 'FALSE'.
C. The _ERROR_ variable is automatically stored in the resulting SAS data set.
D. The _ERROR_ variable can be used in expressions or calculations in the DATA step.

Answer D

Practice Question 105

The following SAS program is submitted:
data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
Click to Get Those Highly Recommended SAS Programmers' Books
do i=1 to 12;     monthsales{i} = sales;     end;     run;
The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.
Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.

Answer is B.

Related links:

Continue to SAS Practice Exam Question Answer Set-21   SAS interview Questions Answers
Back to SAS Practice Exam Question Answer Set-19   SAS Tutorial   Statistics Tutorial