ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 37

A raw data record is listed below:
--------10-------20-------30
1999/10/25
The following SAS program is submitted:
data projectduration;
infile 'file-specification';
input date $ 1 - 10;

run;
Which one of the following statements completes the program above and computes the duration of the project in days as of today's
date?
A. duration = today( ) - put(date,ddmmyy10.);
B. duration = today( ) - put(date,yymmdd10.);
C. duration = today( ) - input(date,ddmmyy10.);
D. duration = today( ) - input(date,yymmdd10.);
Click Comment link to get answer

20 comments:

  1. Anonymous10:40 AM

    sorry ans is D.

    ReplyDelete
  2. Answer is D

    ReplyDelete
  3. Anonymous4:49 PM

    How is yymmdd10. a valid informat?

    ReplyDelete
  4. Anonymous9:47 PM

    in this case
    input(date,ddmmyy10.) is numeric value 14542

    ReplyDelete
  5. Anonymous4:02 PM

    It can not be a PUT function bcz it converts Numeric to Char values. For calculations we need Num variable => So INPUT function, also year is the first mentioned value so answer is D.

    ReplyDelete
  6. Anonymous10:28 AM

    input function converts character to numeric,
    put funtion converts numeric to char ...so here date is given as character,,input function and
    date is in the form of yymmdd10. so D is correct.

    ReplyDelete
  7. Anonymous3:20 PM

    Thks Good explanations.

    ReplyDelete
  8. Anonymous11:27 PM

    But if the character string is:
    1999/10/25
    and the input function is
    yymmdd10.
    isn't that a mismatch (off by 2 digits)?

    ReplyDelete
    Replies
    1. Anonymous6:55 AM

      the forward slashes count as characters

      Delete
  9. Anonymous11:38 PM

    Why not C??

    ReplyDelete
  10. Thank you all for your explanations

    ReplyDelete
  11. Anonymous8:22 AM

    there is 'ddmmyy' in ans C. 'yymmdd' is correct

    ReplyDelete
  12. Your website is really nice and this is a great inspiring article.

    Gclub จีคลับ
    gclub
    goldenslot

    ReplyDelete