SAS Certified Base Programmer 50 Questions (50)
The following SAS program is submitted:
data test; input country $8. date mmddyy10.; cards; Germany 12/31/2000 France 01/32/2001 ; run;
Which one of the following is the value of the variable _ERROR_ when the variable _N_ has a value of 2?
a. 0
b. 1
c. true
d. false
Topics:
SAS Base Questions |
8 Comments »
B
Why shouldn’t the answer be a instead?
_N_ and _ERROR_ are automatic variables that can be used for DATA step processing
but that are not written to the output data set. _N_ counts the number of times that the
DATA step begins to execute, and _ERROR_ signals the occurrence of an error that is
caused by the data during execution. A value of 0 indicates no error while a value of 1
indicates one or more errors. In the program above, the value for date in the second
observation(01/32/2001) is invalid.
You can learn about the automatic variables _N_ and _ERROR_ in Understanding
DATA Step Processing.
Research analyst
Answer : d
The answer is B, as the obs will have an error. The first variable Country is defined to have a width of 8 which reads till the first char of the date also, thereby Date variable will have an INVALID value for the variable. Hence _ERROR_ becomes true and is set to 1.
it’s interesting that you thought you should tell us that you are a research analyst before giving us the wrong answer.
Ans is B.
@surekha deshmukh: This is not a guessing game… The Variable _ERROR_ has only two possible states: 0 or 1 and not true or false. Admin explained it perfectly and so B is the correct answer