*Introduction to Nonparametric Analysis* |

## Comparing Two Related Samples

SAS/STAT software provides the following nonparametric
tests for comparing the locations of two related samples:

- Wilcoxon signed rank test
- sign test
- McNemar's test

The first two tests are available in the UNIVARIATE
procedure, and the last test is available in the FREQ procedure.
When you perform these tests, your data should consist of pairs of
measurements for a random sample from a single population.
For example, suppose your data consist of SAT scores for students
before and after attending a course on how to prepare for the SAT.
The pairs of measurements are the scores before
and after the course, and the students should be a
random sample of students who attended the course.
Your goal in analysis is to decide if the
median change in scores is significantly different from zero.

*Tests in the UNIVARIATE Procedure*

By default, PROC UNIVARIATE performs a
Wilcoxon signed rank test and a sign test.
To use these tests on two related samples, perform the following steps:
- In the DATA step, create a new variable that contains
the differences between the two related variables.
- Run PROC UNIVARIATE, using the new variable in the VAR statement.

For discussion of the tests, formulas, and examples, see the
chapter on the UNIVARIATE procedure in the *SAS Procedures Guide*.

*Tests in the FREQ Procedure*

The FREQ procedure can be used to obtain McNemar's
test, which is simply another special case of a
Cochran-Mantel-Haenszel statistic (and also of the sign test).
The AGREE option in the TABLES statement produces this
test for 2 ×2 tables, and exact *p*-values are
available for this test.

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.