How can a Shapiro-Wilk test be performed in SAS? 2

How can a Shapiro-Wilk test be performed in SAS?

The Shapiro-Wilk test is a statistical test used to determine if a given set of data follows a normal distribution. In SAS, this test can be performed by using the PROC UNIVARIATE procedure. This procedure allows the user to specify the variable of interest and the desired level of significance for the test. The output of the procedure includes the Shapiro-Wilk test statistic, p-value, and a visual plot to assess the normality of the data. By performing the Shapiro-Wilk test in SAS, users can confidently assess the normality of their data and make informed decisions in their statistical analyses.

Perform a Shapiro-Wilk Test in SAS


The Shapiro-Wilk test is used to determine whether or not a dataset follows a normal distribution.

The following step-by-step example shows how to perform a Shapiro-Wilk test for a dataset in SAS.

Step 1: Create the Data

First, we’ll create a dataset that contains 15 observations:

/*create dataset*/
data my_data;
    input x;
    datalines;
3
3
4
6
7
8
8
9
12
14
15
15
17
20
21
;
run;

/*view dataset*/
proc printdata=my_data;

Step 2: Perform the Shapiro-Wilk Test

Next, we’ll use proc univariate with the normal command to perform a Shapiro-Wilk test for normality:

/*perform Shapiro-Wilk test*/proc univariatedata=my_data normal; 
run;

shapiro-wilk test in SAS

The output provides us with a ton of information, but the only table we need to look at is the one titled Tests for Normality.

This table provides the test statistics and p-values for several normality tests including:

  • The Shapiro-Wilk Test
  • The Kolmogorov-Smirnov Test
  • The Cramer-von Mises Test
  • The Anderson-Darling Test

From this table we can see that the p-value for the Shapiro-Wilk test is .3452.

Recall that a Shapiro-Wilk test uses the following null and alternative :

  • H0: The data is normally distributed.
  • HA: The data is not normally distributed.

Since the p-value (.3452) is not less than .05, we fail to reject the null hypothesis.

In other words, it’s safe to assume that the dataset is normally distributed.

Additional Resources

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

Cite this article

stats writer (2024). How can a Shapiro-Wilk test be performed in SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-a-shapiro-wilk-test-be-performed-in-sas/

stats writer. "How can a Shapiro-Wilk test be performed in SAS?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-can-a-shapiro-wilk-test-be-performed-in-sas/.

stats writer. "How can a Shapiro-Wilk test be performed in SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-a-shapiro-wilk-test-be-performed-in-sas/.

stats writer (2024) 'How can a Shapiro-Wilk test be performed in SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-a-shapiro-wilk-test-be-performed-in-sas/.

[1] stats writer, "How can a Shapiro-Wilk test be performed in SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.

stats writer. How can a Shapiro-Wilk test be performed in SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

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