ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 40

The following SAS program is submitted:
data work.month;
date = input('13mar2000',date9.);
run;
Which one of the following represents the type and length of the variable DATE in the output data set?
A. numeric, 8 bytes
B. numeric, 9 bytes
C. character, 8 bytes
D. character, 9 bytes
Click Comment link to get answer

22 comments:

  1. A is the correct answer

    ReplyDelete
    Replies
    1. Anonymous5:39 PM

      As input function converts character variable to numeric variables and numeric variables are always stored in 8 bytes

      Delete
  2. Anonymous9:28 AM

    As numeric variable cannot be more than 8 bytes long

    ReplyDelete
  3. Anonymous10:05 AM

    Date9. format
    numeric, 8bytes

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Anonymous3:07 PM

    Answer is D

    ReplyDelete
  6. Anonymous1:01 PM

    can someone please explain. thanks

    ReplyDelete
  7. Anonymous1:20 PM

    input function converts character data to numeric. Numbers are always stored in 8 byte even when number is as low as 0 or as high as 10000000...

    So correct answer is A, date will be numeric variable with 8 byte length.

    ReplyDelete
    Replies
    1. so what if a number has more than 8 digits??

      Delete
  8. Anonymous1:21 PM

    Also forgot to mention that dates are stored as number inside SAS dataset and depending upon which format you assign it will be displayed accordingly.

    ReplyDelete
  9. Anonymous10:40 PM

    This is the type of question that is cruel and evil and is set up to make you fail.

    So, what does the variable look like?
    13mar200

    ...or what?

    ReplyDelete
    Replies
    1. 13mar2000 (I guess you wanted year to be 2000 and not 200) will get SAS value in terms of number of days from 01Jan1960 (just an example can be 13455, you can see by running in SAS) but if you give format (say e.g mmddyy10. then date be displayed as 03132000. Hope it makes sense.

      Delete
  10. Anonymous2:18 PM

    The answer is D. The input function returns a character value and the variable Date will be defined as character with a length of 9.

    ReplyDelete
  11. )Wow it is really wonderful and awesome thus it is veWow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your site.ry much useful for me to understand many concepts and helped me a lot.
    SAS Training in Bangalore

    ReplyDelete
  12. Thanks For sharing a nice post about all Course.It is very helpful and for us.
    SAS training in bangalore
    SAS institutes in bangalore

    ReplyDelete
  13. Anonymous3:08 PM

    data work.month;
    date = input('13mar2000',date9.);
    run;

    Answer: A

    Because the input function changes the character variable to numeric and we are getting the result as integer value(14682), the length would be 8 bytes. As our friends already mentioned that numbers are always stored in 8 bytes.

    ReplyDelete