By admin | August 10, 2009

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

8 comments | Add One

  1. admin - 08/10/2009 at 10:00 am

    B

  2. Chris - 08/10/2009 at 1:34 pm

    Why shouldn’t the answer be a instead?

  3. admin - 08/10/2009 at 1:40 pm

    _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.

  4. surekha deshmukh - 02/21/2011 at 6:19 am

    Research analyst

    Answer : d

  5. Raji - 05/21/2012 at 5:15 am

    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.

  6. Evan - 10/1/2012 at 5:45 pm

    it’s interesting that you thought you should tell us that you are a research analyst before giving us the wrong answer.

  7. Abhilasha Singh - 01/27/2013 at 8:11 am

    Ans is B.

  8. Nik - 03/11/2013 at 11:49 am

    @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

Leave a Comment

Leave a Reply

Your email address will not be published.