What is the median displayed in PROC MEANS using SAS? 2

What is the median displayed in PROC MEANS using SAS?

The median displayed in PROC MEANS using SAS refers to the middle value in a set of data that is arranged in ascending or descending order. It is calculated by dividing the data into two equal parts, with half of the values falling above and half falling below the median. This statistical measure is useful in determining the central tendency of a dataset and is less affected by extreme values compared to the mean. PROC MEANS in SAS is a procedure used for summarizing data and can produce the median as one of its output statistics.

SAS: Display Median in PROC MEANS


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 meansdata=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 printdata=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 meansdata=my_data;
    var points;
run;

descriptive statistics in SAS using PROC MEANS

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 meansdata=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.

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

Cite this article

stats writer (2024). What is the median displayed in PROC MEANS using SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/what-is-the-median-displayed-in-proc-means-using-sas/

stats writer. "What is the median displayed in PROC MEANS using SAS?." PSYCHOLOGICAL SCALES, 24 Jun. 2024, https://scales.arabpsychology.com/stats/what-is-the-median-displayed-in-proc-means-using-sas/.

stats writer. "What is the median displayed in PROC MEANS using SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/what-is-the-median-displayed-in-proc-means-using-sas/.

stats writer (2024) 'What is the median displayed in PROC MEANS using SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/what-is-the-median-displayed-in-proc-means-using-sas/.

[1] stats writer, "What is the median displayed in PROC MEANS using SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. What is the median displayed in PROC MEANS using SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top