SAS Base Certification Practice – Question 10

Question 10: The contents of the raw data file CALENDAR are listed below:


The following SAS program is submitted:

data test;
infile 'calendar';
input @1 date mmddyy10.;
if date = '01012000'd then event = 'January 1st';

Which one of the following is the value of the EVENT variable?


A. 01012000
B. January 1st
C. . (missing numeric value)
D. The value cannot be determined as the program fails to execute due to errors.

*This blog is not affiliated with SAS or the SAS Institute. All answer logs, data sets, output, and commentary are provided by this blog.

Correct Answer

Incorrect Answer

Click to see Answer Explanation below

thanks for your support


    Keith Apr 20, 2015

    I could be wrong but it says d is the correct answer but where could one possibly know that information from? Isn’t the correct answers b? the sas date value is the issue I believe

    Naoyo Nov 13, 2015

    Hi Keith,

    mmddyy10 is error. I think it should be mmddyy8 since date is 01012000.

    Venkatesh Dec 23, 2015

    Correct Answer is D only, as the ‘DATE CONSTANT’ functions can be verified on DATEX. format not DDMMYYX. format.

    mbvenkat Dec 31, 2015

    Correct answer is D only, as SAS allows to check the date constant value with format ‘DATE7, DATE5, DATE9’ only .

    Date constant check is invalid with format of MMDDYYYY.

    Rajesh Dabral Aug 20, 2016

    if date = ’01JAN2000’d will work fine.

    Rockeps Aug 24, 2016

    Question: If this was a multi step or muti provv problem, would it continue to try to execute other steps? Or once a Data or prov step fails does entire program file ?

    Rockeps Aug 24, 2016

    Sorry…. multi step or PROC

    epiphaniesarefun Aug 28, 2016

    The correct answer is:
    data test;

    input @1 date mmddyy8.;
    if date eq ’01JAN2000’d then event = ‘January 1st’;


    The if statement was in the wrong place and the literal was in the wrong format.

    toan Oct 05, 2016

    So are there TWO syntax errors? The date format of MMDDYY10. should be MMDDYY8. AND the if date= ‘01012000’d is incorrect and should be ddmmmyy/ddmmmyyyy?

      kamkh Feb 15, 2017

      Why isn’t the 3rd statement an error in itself? There are 8 digits in the raw file, so in the log shouldn’t the 3rd statement with the mmddyy10. be a data error?

    Arpi Jul 17, 2017

    we cannot use ‘01012000’d as date constant
    we have to use 01JAN2000 for date constant

    there is no relation with mmddyy10. or mmddyy8. format,
    it will store with similar value of 146101(yearcutoff)

    Marmik Aug 09, 2017

    If it is mmddyy8, then what should be the answer?

      AlJazari Sep 27, 2017

      @Marmik : Has to be 01-01-2000

      Why we apply the format “mmddyy10.” to value that doesn’t need it and after that we use in the condition If the same value regardless of the format.

      If it’s was affected to the wrong format then it’s a data error so the program can execute since it’s a problem with data value.

      Here the program fails so it’s about syntax error.


Leave a Comment

Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let us have a personal and meaningful conversation instead.