data sweat; input x1-x3; cards; 3.7 48.5 9.3 5.7 65.1 8.0 3.8 47.2 10.9 3.2 53.2 12.0 3.1 55.5 9.7 4.6 36.1 7.9 2.4 24.8 14.0 7.2 33.1 7.6 6.7 47.4 8.5 5.4 54.1 11.3 3.9 36.9 12.7 4.5 58.8 12.3 3.5 27.8 9.8 4.5 40.2 8.4 1.5 13.5 10.1 8.5 56.4 7.1 4.5 71.6 8.2 6.5 52.8 10.9 4.1 44.1 11.2 5.5 40.9 9.4 run; proc iml; use sweat; read all into x; n=20; p=3; ones=j(n,1,1); xbar=(1/n)*x`*ones; resid=x-ones*xbar`; s=(1/(n-1))*resid`*resid; print xbar s; mu0={4,50,10}; tsquared=n*(xbar-mu0)`*inv(s)*(xbar-mu0); print tsquared; critvalue05=((n-1)*p/(n-p))*finv(.95,p,n-p); print critvalue05; tailprob=1-probf((n-p)/((n-1)*p)*tsquared,p,n-p); print tailprob; run; quit; The SAS System 16:56 Monday, September 21, 2009 1 XBAR S 4.64 2.8793684 10.01 -1.809053 45.4 10.01 199.78842 -5.64 9.965 -1.809053 -5.64 3.6276579 TSQUARED 9.7387729 CRITVALUE05 10.718605 TAILPROB 0.0649283