The following SAS program is submitted:
data work.month;
date = put('13mar2000'd,ddmmyy10.);
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, 10 bytes
C. character, 8 bytes
D. character, 10 bytes
Click Comment link to get answer
Answer is D
ReplyDeleteanswer is D
ReplyDeleteanyone can please explain why ans is D
ReplyDeleteThank you
becoz put function converts num to char thus date be displayed as 03/13/2000, taking up 10 bytes
Deleteddmmyy10. formats date to be 10 bytes in length i.e dd/mm/yyyy, and 'put' converts value into a character type.
ReplyDeletebut isnt it the wrong format for put()?
ReplyDeleteno it is correct. Just remember we add format for put but Informat for INput; i with i.. hope it helps.
Deleteno.you use a format with put function and informat with input function.format specifies how the value to be written.
ReplyDeleteuse
ReplyDeleteproc contents data=month;
run;
you will get to know how the answer is D.
D
ReplyDeleteAnswer is D
ReplyDeleteD
ReplyDeleteD
ReplyDeleteVery nice article,Keep Updating more posts with us.
ReplyDeleteThank you..
MSBI Online Training India