ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 93

The following SAS program is submitted:
data revenue;
set year_1;
var1 = mdy(1,15,1960);
run;
Which one of the following values does the variable named VAR1 contain?
A. 14
B. 15
C. 1151960
D. '1/15/1960'
Click Comment link to get answer

18 comments:

  1. Anonymous7:29 AM

    (1960)

    The Ans is A. 14

    The MDY function creates a SAS date value from numeric values that represent the month, day, and year.

    ReplyDelete
  2. Anonymous3:33 PM

    can anyone please explain me in detail

    ReplyDelete
  3. For SAS certification we need to assume that YEARCUTOFF option is set to 1JAN1960. This date is represented as 0 in SAS date format. Now MDY function will change normal date to SAS date, we are passing 15JAN1960 as the parameter to mdy which is 14th day from 1JAN1960, hence answer is option A. Hope this helps.

    ReplyDelete
    Replies
    1. thanks for explaination very clear

      Delete
    2. thank you for explanation

      Delete
  4. I am sorry, but the defalt value for yearcutoff is always 1920. That doesn't have anything to do with the SAS start date which is 1st Jan, 1960. Try to run the following code if you have doubt.

    proc options;run;

    ReplyDelete
  5. Anonymous12:24 AM

    Thank you

    ReplyDelete
  6. Anonymous12:26 AM

    thank you

    ReplyDelete
  7. Ranju is right. As the year is in four digit (1960 not just 60), yearcutoff option has nothing to do with this question. Thanks Ranju for correcting.

    SAS dates are special numeric values representing the number of days between January 1, 1960, and a
    specified date.
    For eg
    1jan1959 = -365
    1jan1960 = 0
    1jan1961 = 366

    ReplyDelete
  8. Bombomba12:15 AM

    This is great and helpful. Thanks to Ranju and SASCERT.

    ReplyDelete
  9. Anonymous12:37 PM

    1960 leap year , so 1st jan ,1961 should be 367.
    by joydeep786@gmail.com

    ReplyDelete
  10. Anonymous12:10 AM

    January 1, 1960 0
    January 1, 1961 366

    ReplyDelete
  11. Anonymous11:03 AM

    Answer is A which is 14. Still not a good logic presented.

    ReplyDelete
  12. Anonymous11:15 AM

    jan 1 , 1960 = 0
    jan 15, 1960 = 14

    Keep it in mind that jan 1, 1960 = 0, and jan2, 1960= 2.
    keep going up until 15Jan, 1960, what ever you get is the answer. Therefore ans = (A).
    It will not write in date format until we use date format / informant.
    Do you have still question?
    it will not write the date until
    sakar60

    ReplyDelete
    Replies
    1. Anonymous9:32 AM

      " Keep it in mind that jan 1, 1960 = 0, and jan2, 1960= 2. "
      That is incorrect.
      mdy( 1,1,1960) = 0

      mdy( 1,2,1960) = 1

      Try this sytax in SAS

      Delete