# Example 9: Computing Different Output Statistics for Several Variables

 Features: PROC MEANS statement options: DESCEND NOPRINT CLASS statement OUTPUT statement options: statistic keywords Other features: PRINT procedure WHERE= data set option Data set: GRADE

### Details

This example does the following:
• suppresses the display of PROC MEANS output
• stores the statistics for the class level and combinations of class variables that are specified by WHERE= in the output data set
• orders observations in the output data set by descending _TYPE_ value
• stores the mean exam scores and mean final grades without assigning new variables names
• stores the median final grade in a new variable
• displays the output data set

## Program

options nodate pageno=1 linesize=80 pagesize=60;
class Status Year;
output out=Sumdata (where=(status='1' or _type_=0))
run;
proc print data=Sumdata;
title2 'and for All Students';
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. DESCEND orders the observations in the OUT= data set by descending _TYPE_ value.
Specify subgroups for the analysis. The CLASS statement separates the analysis by values of Status and Year.
class Status Year;
Specify the analysis variables. The VAR statement specifies that PROC MEANS calculate statistics on the Score and FinalGrade variables.
Specify the output data set options. The OUTPUT statement writes the mean for Score and FinalGrade to variables of the same name. The median final grade is written to the variable MedianGrade. The WHERE= data set option restricts the observations in SUMDATA. One observation contains overall statistics (_TYPE_=0). The remainder must have a status of 1.
output out=Sumdata (where=(status='1' or _type_=0))