You can use **PROC MEANS** to calculate summary statistics for variables in SAS.

By default, **PROC MEANS** does not display the median value as one of the summary statistics but you can use the following syntax to include the median in the output:

proc means data=my_data N Mean Median Std Min Max; var points; run;

This particular example calculates the total number of observations, mean, median, standard deviation, minimum and maximum value for a variable called **points**.

The following example shows how to use this syntax in practice.

**Example: Display Median in PROC MEANS in SAS**

Suppose we have the following dataset in SAS that contains information about various basketball players:

/*create dataset*/ data my_data; input team $ points assists; datalines; A 10 2 A 17 5 A 17 6 A 18 3 A 15 0 B 10 2 B 14 5 B 13 4 B 29 0 B 25 2 C 12 1 C 30 1 C 34 3 C 12 4 C 11 7 ; run; /*view dataset*/ proc print data=my_data;

Suppose we use **PROC MEANS** to calculate summary statistics for the **points** variable in the dataset:

/*calculate summary statistics for points variable*/ proc means data=my_data; var points; run;

By default, **PROC MEANS** calculates the following descriptive statistics:

**N**: The total number of observations**Mean**: The mean value of points**Std**Dev: The standard deviation of points**Minimum**: The minimum value of points**Maximum**: The maximum value of points

Notice that the median value is not included in the output.

We can use the following syntax to include the median value in the output:

/*calculate summary statistics for points and include median value*/ proc means data=my_data N Mean Median Std Min Max; var points; run;

Notice that the output now includes the median value for the **points** variable.

We can see that the median value for the **points** variable turns out to be **15**.

**Additional Resources**

The following tutorials explain how to perform other common tasks in SAS:

How to Calculate Descriptive Statistics in SAS

How to Create Frequency Tables in SAS

How to Calculate Percentiles in SAS

How to Create Pivot Tables in SAS