--------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
A
ReplyDeletesorry ans is D.
ReplyDeleteD
ReplyDeleteAnswer is D
ReplyDeleteD
ReplyDeleteHow is yymmdd10. a valid informat?
ReplyDeletein this case
ReplyDeleteinput(date,ddmmyy10.) is numeric value 14542
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.
ReplyDeleteinput function converts character to numeric,
ReplyDeleteput 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.
Thks Good explanations.
ReplyDeleteD
ReplyDeleteBut if the character string is:
ReplyDelete1999/10/25
and the input function is
yymmdd10.
isn't that a mismatch (off by 2 digits)?
the forward slashes count as characters
DeleteWhy not C??
ReplyDeleteThank you all for your explanations
ReplyDeleteD
ReplyDeleteD
ReplyDeletethere is 'ddmmyy' in ans C. 'yymmdd' is correct
ReplyDeleteYour website is really nice and this is a great inspiring article.
ReplyDeleteGclub จีคลับ
gclub
goldenslot
D
ReplyDelete