P-values for one
and two-tailed tests are
output ;
*****;
data a; * Enter, after
the cards statement, the values
for ;
N, U, CAT1,
CAT2, in this order. Each value
should *;
be separated
by a space. In this example
N=35, *;
* U=16, CAT1=21,
and
CAT2=14
;
input n u cat1 cat2;
cards;
35 16 21 14
;
DO NOT EDIT
BEYOND THIS LINE*;
data a; set a;
label
p1= 'One-tailed test p-value'
p2= 'Two-tailed test p=value'
;
a = 2 (cat1cat2);
if u < (a/ (n+1)) then adj=0.5
;
else if u > (a/(n+1) then
adj=−0.5 ;
b= (u+ (adj − (a/n))) −1;
c= (a (a − n));
d= ((nn) (n − 1));
e= sqrt (c/d);
z= abs (b/e);
p=round (1− (probnorm(z)) ,
.0001);
p1=p;
p2=2*p1;
proc print label;
var z p1 p2;
run ;
Figure 9: Program for
one-sample runs test for
randomness
Appendix 371