avg=Mean(x, y, z); avg=Mean(of x1-x10); avg=Mean(of x y z);
Answer B. average = mean(of num1 - num4);
The problem with the D is the coma between the variable. It can be either mean (of var1, var2, var 3, var4) or mean (var1, var2, var 3, var4) or mean (of var1-var4) but can not be mean (of var1 to var4) or mean (var1-var4)
Question :
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?
Explanation: Yes the default length for the variable on r.h.s of scan function is 200 Submit the following code and check the length of FIRST in the SAS output. Then, you can be sure that the correct answer is 4 because FIRST has a length of 200.
data work.test; Author = 'Agatha Christie'; First = substr(scan(author,1,' ,'),1,1); run; proc contents; run; Alphabetic List of Variables and Attributes
# Variable Type Len
1 Author Texte 15 2 First Texte 15
In fact, with susbstr, SAS keep the length of the variable "author". Here, it's 15.
Then, the default length of a scan function is 200.
So, because we use a scan function inside the substr function, the length of "first" will be the same as the length for scan - -> 200
Question :
The following SAS program is submitted: data work.test; Author = 'Christie, Agatha'; First = substr(scan(author,2,' ,'),1,1); run; Which one of the following is the value of the variable FIRST in the output data set?
Explanation: Even if there is a space between the comma and the Agatha, it does not matter because 'blank' or ;space' is also one of the several(blank . ( + | & ! $ * ) ; ^ - / , % default delimiters.
The default delimiters don't matter. The delimiters are defined. So the question is whether blank is a delimiter. Here it is whether the questioner meant it to be or not. Hence A is the answer. Remove the blank from the list and D is the answer.
data work.test; Author = 'Christie, Agatha'; First = substr(scan(author,2,' ,'),1,1); run;
This has blank and comma as delimiters.
data work.test; Author = 'Christie, Agatha'; First = substr(scan(author,2,','),1,1); run;
This just commma.
Very hard thing to notice as you can see looking at the two. Hope nothing like that is on the base sas, too easy to make a mistake.