/* Studentized(Standardized) Range */ /* This program is a GAUSS version of Studentized Range test in 'gofnorm' */ /* (Fortran code by Paul Johnson) located in library 'fBasics' of R. */ new; cls; x=rndn(100,1); call StudentRange(x); proc StudentRange(x); local n,s2,stat; if ismiss(x); errorlog "Warning: missing data found."; x=packr(x); endif; n=rows(x); x=sortc(x,1); s2=sumc((x-meanc(x))^2)/(n-1); stat=(x[n]-x[1])/sqrt(s2); /* Or, stat=(x[n]-x[1])/stdc(x); */ print "stat=" stat; retp(stat); endp;