SAS Macro : Test for Normal Distribution

Live Online Training : SAS Programming with 50+ Case Studies

- Explain Programming Concepts in Simple English
- Live Projects
- Scenario Based Questions
- Job Placement Assistance
- Get 10% off till Sept 25, 2017
- Batch starts from October 8, 2017

In most of the statistical tests, you need check assumption of normality. There is a test called Shapiro-Wilk W test that can be used to check normal distribution. If the p-value is greater than .05, it means we cannot reject the null hypothesis that a variable is normally distributed.

SAS Macro for Normality

/*************************************************
*input = dataset to check;
*vars = Specify variable(s) for which you want to check normality;
*output = dataset to output with normality status;
**************************************************/

%macro normal(input=, vars=, output=);

ods output TestsForNormality = Normal;
proc univariate data = &input normal;
var &vars;
run;
ods output close;

data &output;
set Normal ( where = (Test = 'Shapiro-Wilk'));
if pValue > 0.05 then Status ="Normal";
else Status = "Non-normal";
drop TestLab Stat pType pSign;
run;
%mend;

%normal(input=test, vars=X1 X2, output=Normality);

SAS Tutorials : 100 Free SAS Tutorials

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.


While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "SAS Macro : Test for Normal Distribution"

Post a Comment

Next → ← Prev