1.
Which of the following is not created during the compilation phase?
Correct Answer
B. The first observation
Explanation
At the beginning of the compilation phase, the program data vector is created. The porogram data vector includes the two automatic variables _N_ and _ERROR_. The descriptor portion of the new SAS data set is created at the end of the compilation phase. The descriptor portion includes the name of the data set, the number of observations and variables, and the names and attributes of the variables. Observations are not written until the execution phase.
2.
During the compilation phase, SAS scans each statement in the DATA step, looking for syntax errors. Which of the following is not considered a syntax error?
Correct Answer
A. Incorrect values and formats
Explanation
Syntax checking can detect many common errors, but it cannot verify the values of variables or the correctness of formats.
3.
Unless otherwise directed, the DATA step executes...
Correct Answer
C. Once for each record in the input file.
Explanation
The DATA step executes once for each record in the input file, unless otherwise directed.
4.
At the beginning of the execution phase, the value of _N_ is 1, the value of _ERROR_ is o, and the value variables are set to:
Correct Answer
D. Missing
Explanation
The remaining variables are initialized to missing. Missing numeric values are represented by periods, and missing character values are represented by blanks.
5.
Suppose you run a program that causes three DATA step erros. What is the value of the automatic variable _ERROR_ when the observation that contains the third error is processed?
Correct Answer
B. 1
Explanation
The default value of _ERROR_ is 0, which means that there is no error. When an error occurs, whether one error or multiple errors, the value is set to 1.
6.
Which of the following actions occurs at the end of an iteration of the DATA step?
Correct Answer
D. The values of variables created in programming statements are re-set to missing in the program data vector.
Explanation
By default, at the end of the DATA step, the values in the program data vector are written to the data set as an observation, the value of the automatic variable _N_ is incremented by one, control returns to the top of the DATA step, and the values of variables created in programming statements are re-set to missing. The automatic variable _ERROR_ retains its value.
7.
Look carefully at the DATA step shown below. Based on the INPUT statement, in what order will the variables be stored in the new data set?
data perm.update;
infile invent;
input IDnum $ Item $ 1-13 Instock 21-22
BackOrd 24-25;
Total=instock+backord;
run;
Correct Answer
A. IDnum Item InStock BackOrd Total
Explanation
The order in which variables are defined in the DATA step determines the order in which the variables are stored in the data set.
8.
If SAS cannot interpret syntax errors, then...
Correct Answer
C. The DATA step still compiles, but it does not execute.
Explanation
When SAS can't interpret syntax errors, the DATA step compiles, but it does not execute.
9.
What is wrong with this program?
data perm.update;
infile invent
input Item $ 1-13 IDnum $ 15-19 Instock 21-22
BackOrd 24-25;
total=instock+backord;
run;
Correct Answer
A. Missing semicolon on the second line
Explanation
A semicolon is missing from the second line. It will cause an error because the INPUT statement will be interpreted as invalid INFILE statement options.
10.
Look carefully at this section of a SAS session log. Based on the note, what was the most likely problem with the DATA step?
NOTE: Invalid data for IDnum in line 7 15-19.
RULE: ----+----1----+----2----+----3----+----4
7 Bird Feeder LG088 3 20
Item=Bird Feeder IDnum=. InStock=3 BackOrd=20
Total=23 _ERROR_=1 _N_=1
Correct Answer
D. A dollar sign was missing in the INPUT statement.
Explanation
The third line of the log displays the values for IDnum, which are clearly character values. The fourth line displays the values in the program data vector and shows that the values for IDnum are missing, even though the values are correctly assigned. Thus, it appears that numeric values were expected for IDnum. A dollar sign, to indicate character values, must be missing from the INPUT statement.