	subroutine spearman(n,x,y,srocc)

c	4/2000 Byron Gleason NCDC

c	No missing data are allowed in x(n) or y(n)!
c	No ties are allowed!

	real x(n),y(n),diff(200)
	real srocc	! spearman rank order correlation coefficient
	real miss	! this is put in here to satisy Malcolm's rank routine
	real SumOfSqDiff 

c	Initialization

	miss = -99.99   ! This is just to satisfy Malcolm's rank routine

c	Rank X and Y Series

	call replace_reverserank(n,x,miss)
	call replace_reverserank(n,y,miss)

	do i=1,n
	  write (*,*) x(i)
	enddo

c	Compute Difference between Ranks 

	do i=1,n
	  diff(i) = x(i)-y(i)
	enddo

c	Square all differences

	do i=1,n
	  diff(i) = diff(i)**2
	enddo

c	Sum all of the squared differences

	SumOfSqDiff = 0.0

	do i=1,n
	  SumOfSqDiff = diff(i) + SumOfSqDiff
	enddo

c	Calculate Coefficient

	srocc = (1-((6*SumOfSqDiff)/(n**3-n)))

	return
	end
