Published on :
Statistical INTERNAL_CREATION

PROC NPAR1WAY Example: Exact Wilcoxon Test

This code is also available in: Deutsch Español Français
Awaiting validation
This script creates a 'React' dataset containing reaction times for two stimulus groups. It then executes the NPAR1WAY procedure to perform a Wilcoxon-Mann-Whitney test. The 'correct=no' option suppresses the continuity correction, and the 'exact wilcoxon' statement requests the exact p-value calculation, which is relevant for small samples.
Data Analysis

Type : INTERNAL_CREATION


Data is generated via the DATALINES statement in the DATA step 'React'.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'React' dataset. The 'input' statement uses ' @@' (double trailing at) to read multiple observations per data line, thus correcting the artifact present in the provided source code.
Copied!
1DATA React;
2 INPUT Stim Time @@;
3 DATALINES;
41 1.94 1 1.94 1 2.92 1 2.92 1 2.92 1 2.92 1 3.27
51 3.27 1 3.27 1 3.27 1 3.70 1 3.70 1 3.74
62 3.27 2 3.27 2 3.27 2 3.70 2 3.70 2 3.74
7;
2 Code Block
PROC NPAR1WAY
Explanation :
Execution of the non-parametric analysis. 'wilcoxon' requests the rank test. 'exact wilcoxon' calculates the exact significance.
Copied!
1PROC NPAR1WAY wilcoxon correct=no DATA=React;
2 class Stim;
3 var Time;
4 exact wilcoxon;
5RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : SAS Sample Library (NPAR1EX3); Copyright (c) 2016 Scott Bass (included in the TEMPLATE.sas model)