    Program g07ebfe

!     G07EBF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. 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
