SAS Base (10)

Given the existing SAS program:

proc format;
value agegrp
low-12 =’Pre-Teen’
13-high = ‘Teen’;

proc means data=SASHELP.CLASS;
var Height;
class Sex Age;
format Age agegrp.;

Which statement in the proc means step needs to be modified or added to generate the following results:

Analysis Variable : Height
Sex Age N Obs Minimum Maximum Mean
F Pre-Teen 3 51.3 59.8 55.8
  Teen 6 56.5 66.5 63.0
M Pre-Teen 4 57.3 64.8 59.7
  Teen 6 62.5 72.0 66.8

A. var Height / nobs min max mean maxdec=1;
B. proc means data=SASHELP.CLASS maxdec=1 ;
C. proc means data=SASHELP.CLASS min max mean maxdec=1;
D. output nobs min max mean maxdec=1;

Check Answer
Answer: C

注解:PROC MEANS默认会输出非missing观测值个数、均值、标准差、最小值和最大值。题目只需要输出最小值(MIN)、最大值(MAX)和均值(MEAN),并显示小数点后一位(MAXDEC)。其中N Obs是观测值个数(包括missing和非missing),要去掉的话使用NONOBS,即proc means data = XXXX nonobs。

Leave a Reply

Your email address will not be published. Required fields are marked *