```
data TTR;
set TTR;= TRT_B - TRT_A;
diff run;
```

# Wilcoxon signed-rank test in SAS & StatXact®

**Introduction**

Similarily to what has been presented in R, we will explore the options of Wilcoxon Signed-Rank test that are avialable in SAS & StatXact.We will consider case with N>=20 or N<20 and without or with ties. For more information how to perform this analysis in R go here

### Data

Analysis was be conducted on the same example dataset as in R.

Again, wilcoxon signed rank test was applied to analyse the time to return to baseline FEV1 post-mannitol challenge 2.

## Analysis in SAS

### Dataset without ties and N > 20

Let’s consider a case where the dataset has no ties and N (number of observations) = 240.

In SAS Wilcoxon Signed-Rank test is available using PROC UNIVARIATE.

```
=TTR
proc univariate data=0.1;
alpha
var diff; run;
```

### Dataset without ties and N≤20

Now let’s consider a smaller dataset, created by selecting first 19 observations from our main data.

```
data TTR_19;
set TTR;if _N_ <= 19;
run;
```

```
=TTR_19
proc univariate data=0.1;
alpha
var diff; run;
```

### Important notes on SAS

- Only PROC UNIVARIATE can be used in SAS to perform Wilcoxon Signed-Rank test. SAS documentation details are here.
- In regards to Wilcoxon S-R test, SAS provides only p value
- Hodges-Lehmann estimator or CI are not available and have to be implemented manually
- Provided p value is based on Signed Rank (S) statistic (modification of a common T+). Details are here
- SAS computes exact p values only for N ≤ 20. For larger samples uses an asymptotic t-Student distribution of the test statistic. For more information how the p value is calculated go here
- PROC UNIVARIATE apart from performing Wilcoxon S-R test presents as well basic statistical measures of variability and location, e.g median. The given median is not a “pseudo-median” (median of the Walsh averages), it is a “normal” median of the considered variable.
- Using CIQUANTNORMAL option we can get confidence limits for quantiles based on normal distribution. There are 5 different definitions for calculation quantiles available. See details from the SAS documentation here. It is important to note, those are not confidence intervals of estimator.

### Approach to 0s and ties in SAS

- In SAS all the 0 differences are disregarded (Hollander and Wolfe, 1973). The sample size N is reduced to reflect the number of discarded zeros.
- Tied differences are given an average of the ranks. Statistic S is updated accordingly following Sprent algorythm (Sprent, 1993).

## Analysis in StatXact®

StatXact® PROCs for SAS users is a clinical trial analysis software from Cytel for exact statistics. Package includes more than 150 procedures for exact inference statistical data and power analysis.

### Dataset without ties and N > 20

```
/* Wilxocon S-R test - p values */
=WilcoxonSignedRank_TTR
PROC PAIRED DATA=0.9;
ALPHA/EX;
WI- TRT_A;
POPS TRT_B RUN;
```

```
/* Wilcoxon S-R - H-L estimator and CI */
=WilcoxonSignedRank_TTR
PROC PAIRED DATA=0.9;
ALPHA/EX;
HL- TRT_A;
POPS TRT_B RUN;
```

### Important notes on StatXact®

- Only PROC PAIRED can be used in StatXact to perform Wilcoxon Signed-Rank test
- Follows Sprent (1993) approach for Wilcoxon Signed-Rank test and Lehmann (1975) for H-L estimate and CI
- Provides exact/non-exact p values, (exact) H-L estimator and exact/non-exact CIs
- p value is based on a common T+ statistic (sum of ranks of the positive differences)

### Approach to 0s and ties in StatXact®

- Using ZEROS option we can compute H-L estimate including all differences, but by default 0s are excluded.
- Tied differences are given an average of the ranks. Statistic S is updated accordingly following Sprent algorythm (Sprent, 1993).