	subroutine variance(n,rMiss,rX,rVariance,iErr)

c	Calculate the variance of a set of numbers

c	EQUATION:	Sigma (y - y(bar))**2
c		        ______________________
c			      n - 1

********************

c	Declarations

	real rX(1:n)

********************

	iErr = 0

	call ssmean(n,rMiss,rX,rSSMean,iErr1) ! find sum of squares about mean

	if (iErr1.eq.1) then
	  iErr = 1
	  return
	endif

	iMiss = 0

	do i=1,n
          if (rX(i).eq.rMiss) then
	    iMiss=iMiss+1
	  endif
	enddo	  

	rVariance = ( rSSMean / ((n-iMiss)-1) )
		
	return
	end
