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
A is the correct answer
ReplyDeleteAs input function converts character variable to numeric variables and numeric variables are always stored in 8 bytes
Delete8
ReplyDeleteAs numeric variable cannot be more than 8 bytes long
ReplyDelete'A'
ReplyDeleteDate9. format
ReplyDeletenumeric, 8bytes
This comment has been removed by the author.
ReplyDeleteD
ReplyDeleteAnswer is D
ReplyDeletecan someone please explain. thanks
ReplyDeleteinput 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...
ReplyDeleteSo correct answer is A, date will be numeric variable with 8 byte length.
so what if a number has more than 8 digits??
DeleteAlso forgot to mention that dates are stored as number inside SAS dataset and depending upon which format you assign it will be displayed accordingly.
ReplyDeletethanks
DeleteThis is the type of question that is cruel and evil and is set up to make you fail.
ReplyDeleteSo, what does the variable look like?
13mar200
...or what?
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.
DeleteA
ReplyDeleteA
ReplyDeleteThe 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)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.
ReplyDeleteSAS Training in Bangalore
Thanks For sharing a nice post about all Course.It is very helpful and for us.
ReplyDeleteSAS training in bangalore
SAS institutes in bangalore
data work.month;
ReplyDeletedate = 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.