The following SAS program is submitted:
data work.test;
Author = 'Agatha Christie';
First = substr(scan(author,1,' ,'),1,1);
run;
Which one of the following is the length of the variable FIRST in the output data set?
The following SAS program is submitted:
data work.test;
Author = 'Agatha Christie';
First = substr(scan(author,1,' ,'),1,1);
run;
Which one of the following is the length of the variable FIRST in the output data set?
The length of the variable FIRST is determined by analyzing the SAS program. The FIRST variable is created by extracting the first character from the first word in the variable AUTHOR using the SUBSTR and SCAN functions. Since the length of the SUBSTR function is specified as 1, the length of the variable FIRST is 1.
o/p is : 15 data work.test; Author = 'Agatha Christie'; First = substr(scan(author,1,' ,'),1,1); length = lengthc(first); run;
Answer is C which is 15. Executed program and checked
correct answer is C, length is 15
Why answer is D?