Unless specified, which variables and data values are used to calculate statistics in the MEANS procedure?
A. non-missing numeric variable values only
B. missing numeric variable values and non-missing numeric variable values only
C. non-missing character variables and non-missing numeric variable values only
D. missing character variables, non-missing character variables, missing numeric variable values, and non-missing numeric variable
values
B. missing numeric variable values and non-missing numeric variable values only
C. non-missing character variables and non-missing numeric variable values only
D. missing character variables, non-missing character variables, missing numeric variable values, and non-missing numeric variable
values
3 comments:
Answer A
It is B
Check this out. A missing numeric variable is accepted
data test;
infile datalines dsd;
length a b $20;
input a $ b $ c ;
label a=kolom_a b=kolom_b c=number;
datalines;
dit is een,dit is twee,1
dit is drie,dit is twee,
dit is drie,dit is twee,2
;
proc print data=test;run;
proc means data=test;run;
The answer of Dutchy is incorrect. SASGuru gave the right answer. That's because proc means does actually work when reading a missing numeric value from the data set, meaning that it doesn't produce an error and the report is generated. However, the missing values are not taken into accout when computing the statistics.
For instance, if the null values were considered, the example provided by Dutchy would have output 1 as average, because it would have counted 3 values and computed (1+2)/3 = 1. Instead, the mean is equal to 1.5 (try that yourself). That means that SAS considers only the two non-missing values and computes the average as (1+2)/2 = 1.5
Post a Comment