    PROGRAM g07ebfe

!      G07EBF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g07ebf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: clevel, estcl, theta, thetal,        &
                                          thetau, ulower, uupper
       INTEGER                         :: ifail, m, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: wrk(:), x(:), y(:)
       INTEGER, ALLOCATABLE            :: iwrk(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G07EBF Example Program Results'
       WRITE (nout,*)

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

!      Read in problem size and confidence level
       READ (nin,*) n, m, clevel

       ALLOCATE (x(n),y(m),iwrk(3*n),wrk(3*(m+n)))

!      Read in first sample
       READ (nin,*)
       READ (nin,*) x(1:n)

!      Read in second sample
       READ (nin,*)
       READ (nin,*) y(1:m)

!      Calculate statistics
       ifail = 0
       CALL g07ebf('Approx',n,x,m,y,clevel,theta,thetal,thetau,estcl,ulower, &
          uupper,wrk,iwrk,ifail)

!      Display results
       WRITE (nout,*) ' Location estimator     Confidence Interval '
       WRITE (nout,*)
       WRITE (nout,99999) theta, '(', thetal, ' ,', thetau, ' )'
       WRITE (nout,*)
       WRITE (nout,*) ' Corresponding Mann-Whitney U statistics'
       WRITE (nout,*)
       WRITE (nout,99998) 'Lower : ', ulower
       WRITE (nout,99998) 'Upper : ', uupper

99999  FORMAT (3X,F10.4,12X,A,F7.4,A,F7.4,A)
99998  FORMAT (1X,A,F8.2)
    END PROGRAM g07ebfe
