SAS Base Programming for SAS 9 — Question 19
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?
Answer options
- A. 1
- B. 6
- C. 15
- D. 200
Correct answer: D
Explanation
In SAS, character variables are assigned a default length of 200 unless specified otherwise. The FIRST variable is derived from the Author variable, which does not limit its length explicitly, so it retains the default length of 200. The other options do not represent the actual length of the variable as per SAS's default behavior.