# Example 8: Computing Output Statistics

 Features: PROC MEANS statement option: NOPRINT CLASS statement OUTPUT statement options: statistic keywords IDGROUP LEVELS WAYS Other features: PRINT procedure Data set: GRADE

### Details

This example does the following:
• suppresses the display of PROC MEANS output
• stores the average final grade in a new variable
• stores the name of the student with the best final exam scores in a new variable
• stores the number of class variables are that are combined in the _WAY_ variable
• stores the value of the class level in the _LEVEL_ variable
• displays the output data set

## Program

`options nodate pageno=1 linesize=80 pagesize=60;`
`proc means data=Grade noprint;`
`   class Status Year;`
`   var FinalGrade;`
```   output out=sumstat mean=AverageGrade
idgroup (max(score) obs out (name)=BestScore)
/ ways levels;
run;```
```proc print data=sumstat noobs;
title2 'For Two Years';
run;```

## Program Description

Set the SAS system options. The NODATE option suppresses the display of the date and time in the output. PAGENO= specifies the starting page number. LINESIZE= specifies the output line length, and PAGESIZE= specifies the number of lines on an output page.
`options nodate pageno=1 linesize=80 pagesize=60;`
Specify the analysis options. NOPRINT suppresses the display of all PROC MEANS output.
`proc means data=Grade noprint;`
Specify subgroups for the analysis. The CLASS statement separates the analysis by values of Status and Year.
`   class Status Year;`
Specify the analysis variable. The VAR statement specifies that PROC MEANS calculate statistics on the FinalGrade variable.
`   var FinalGrade;`
Specify the output data set options. The OUTPUT statement creates the SUMSTAT data set and writes the mean value for the final grade to the new variable AverageGrade. IDGROUP writes the name of the student with the top exam score to the variable BestScore and the observation number that contained the top score. WAYS and LEVELS write information about how the class variables are combined.
```   output out=sumstat mean=AverageGrade
idgroup (max(score) obs out (name)=BestScore)
/ ways levels;
run;```
Print the output data set WORK.SUMSTAT. The NOOBS option suppresses the observation numbers.
```proc print data=sumstat noobs;