# Calculating mean in SAS
To calculate mean simply use **proc means**
```sas
proc means data = work.test;
var ratings;
run;
```
This will give mean of ratings only.
Mean of sorted data.
```sas
proc means data = work.test;
var ratings;
by post;
run;
```
Above code throws error because data is not sorted. To use **by** sorting is required.
Thus, sorting data:
```sas
proc sort data=work.test;
by post;
run;
```
# Printing only mean
```sas
proc means data = work.test mean;
var rating;
class post;
run;
```
# Printing mean max min std
```sas
proc means data = work.test mean min max std;
var rating;
class post;
run;
```
# Printing mean min max std meadian sum
```sas
proc means data = work.test mean min max std median sum;
var rating;
class post;
run;
```