The following SAS DATA step executes on Monday, April 25, 2000:
data newstaff;
set staff;
start_date = today();
run;
Which one of the following is the value of the variable START_DATE in the output data set?
A. a character string with the value '04/25/2000'
B. a character string with the value 'Monday, April 25, 2000'
C. the numeric value 14725, representing the SAS date for April 25, 2000
D. the numeric value 04252000, representing the SAS date for April 25, 2000
Click Comment link to get answer
Answer is C.
ReplyDeletehello could u please explain me how the answer is C i thought it should be D
DeleteThe easiest way to think about it is the # of days to Jan 1, 1960. If you even think about it roughly, 40 years * 365 days = 14,600 days, which is much closer to the value of C than D.
Deletethe function today() returns the sas date constant which is an integer value.
Delete& D is not an valid integer. Its a date if you look at it closely. so the correct answer is C
Deleteplease why do you, take the reference with Jan 1, 1960
DeleteC
ReplyDeleteToday's date is given in the SAS date form
ReplyDeleteThe Ans is:
C. the numeric value 14725
C
ReplyDeletec
ReplyDeleteC
ReplyDeleteCan anyone explain with little info, please? i am stuck in this topic. :(
ReplyDeletethe start_date is a numeric value. Since the SAS sets the 1/1/1960 as 0, so this date is 14725.
DeleteCould u please explain it to me properly I didn't get it and stuck in it thanks
Deletein SAS date is stored as numeric with '01JAN1960'd or 0 as base date. Year difference between 2000 and 1960 is 41 years. 41*365 days won't be 04252000 (huge number). Therefore, answer is C.
ReplyDeleteOther way to is to run the code. But in exam you won't get chance to run the code. One need to answer based on simple calculation (approximate value).
"04252000 (huge number)" this is not a no. actually. If you observes, it's 04 25 2000, the actual date 25th april 2000
Deletewe used today function over here when we use function it converts date into sas date such as numbers while when we use formats we directly coverts it into various date formats as you mentioned above
DeleteC
ReplyDelete