A raw data record is listed below:
--------10-------20-------30
1999/10/25
1999/10/25
The following SAS program is submitted:
data projectduration;
infile 'file-specification';
input date $ 1 - 10;
run;
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.);
3 comments:
Answer: D
The input date is character variable whose value should be converted to numeric using the input function with the yymmdd10. Informat.
we have to add 1 for no .of days calculations
If you have to convert a char variable to numeric, you must use INPUT-function (numeric to char is PUT-function).
So it must be C or D
Only D used the correct informat.
So it is D
Post a Comment