    PROGRAM g08dafe

!      G08DAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g08daf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: p, w
       INTEGER                         :: i, ifail, k, ldx, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: rnk(:,:), x(:,:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G08DAF Example Program Results'
       WRITE (nout,*)

!      Skip heading in data file
       READ (nin,*)

!      Read in the problem size
       READ (nin,*) k, n

       ldx = k
       ALLOCATE (x(ldx,n),rnk(ldx,n))

!      Read in data
       READ (nin,*) (x(i,1:n),i=1,k)

!      Display title
       WRITE (nout,*) 'Kendall''s coefficient of concordance'
       WRITE (nout,*)

!      Display data
       WRITE (nout,*) 'Data values'
       WRITE (nout,*)
       WRITE (nout,99999) ('Comparison ',i,' scores  ',x(i,1:n),i=1,k)

       ifail = 0
       CALL g08daf(x,ldx,k,n,rnk,w,p,ifail)

!      Display results
       WRITE (nout,*)
       WRITE (nout,99998) 'Kendall''s coefficient =', w
       WRITE (nout,99998) '          Significance =', p

99999  FORMAT (1X,A,I1,A,10F5.1)
99998  FORMAT (1X,A,F8.3)
    END PROGRAM g08dafe
