The MEANS Procedure

# Example 3: Using the BY Statement with Class Variables

Procedure features:

PROC MEANS statement option:

 statistic keywords

BY statement

CLASS statement

Other features:
 SORT procedure

This example

• separates the analysis for the combination of class variables within BY values

• shows the sort order requirement for the BY statement

• calculates the minimum, maximum, and median.

 `options nodate pageno=1 linesize=80 pagesize=60;`
 ```proc sort data=Grade out=GradeBySection; by section; run;```
 `proc means data=GradeBySection min max median;`
 ` by Section;`
 ` var Score;`
 ` class Status Year;`
 ``` title1 'Final Exam Scores for Student Status and Year of Graduation'; title2 ' Within Each Section'; run;```

```          Final Exam Scores for Student Status and Year of Graduation          1
Within Each Section

---------------------------------- Section=A -----------------------------------

The MEANS Procedure

Analysis Variable : Score

N
Status    Year    Obs         Minimum         Maximum          Median
---------------------------------------------------------------------
1         97        1      85.0000000      85.0000000      85.0000000

98        1      92.0000000      92.0000000      92.0000000

2         97        3      82.0000000      90.0000000      88.0000000
---------------------------------------------------------------------

---------------------------------- Section=B -----------------------------------

Analysis Variable : Score

N
Status    Year    Obs         Minimum         Maximum          Median
---------------------------------------------------------------------
1         97        2      78.0000000      91.0000000      84.5000000

98        2      84.0000000      89.0000000      86.5000000

2         98        1      81.0000000      81.0000000      81.0000000
---------------------------------------------------------------------
```

 Previous Page | Next Page | Top of Page