	subroutine cluster_stan(iObjects,iAttributes,
     +			  	rDataMatrix,rStanDataMatrix,iErr)

c	Standardize a data matrix to be used in cluster analysis

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

c	Declarations

	real rDataMatrix(1:iObjects,1:iAttributes) 
	real rStanDataMatrix(1:iObjects,1:iAttributes) 
	real rDummyX(1:10000)
	real rAttributeMeans(1:10000)
	real rAttributeStDev(1:10000)

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

c	Check to make sure rDataMatrix is not too large

	iTotal = iObjects*iAttributes
	if (iTotal.gt.10000) then
	  iErr=1
	  return
	endif

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

c	Initialization

	rMiss = -99.99
	iErr = 0

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

c	Main

	do j=1,iAttributes
	iCount=0
	  do i=1,iObjects 
	    iCount=iCount+1
	    rDummyX(iCount) = rDataMatrix(i,j)
	  enddo
	  call mean(iCount,rMiss,rDummyX,rMean,iErr1)
	  if (iErr1.eq.0) then
	    rAttributeMeans(j) = rMean
	  else
	    iErr=1
	    return
	  endif
	  call stdev(iCount,rMiss,rDummyX,rStDev,iErr2)
	  if (iErr2.eq.0) then
	    rAttributeStDev(j) = rStDev
	  else
	    iErr=1
	    return
	  endif
	enddo

	do i=1,iObjects
	  do j=1,iAttributes
	  rStanDataMatrix(i,j) = (rDataMatrix(i,j)
     +                              -rAttributeMeans(j))
     +                                /rAttributeStDev(j)
	  enddo
	enddo

	return
	end
