goptions reset=global gunit=in ftitle="garamond" ftext="garamond" htitle=.5 htext=.3; Title1 'T-Tests and Confidence Limits'; PROC IMPORT OUT= WORK.TIMETECH DATAFILE= "F:\Courses\anth588\TimeTech.xls" DBMS=EXCEL2000 REPLACE; GETNAMES=YES; RUN; data Proj4Data; set timetech; if (site = 'APPLECRK' and prov='F203') or (site = 'MACOUPIN' and prov='F173') or (site = 'BOULDER' and prov='F59') or (site = 'BRIDGES' and prov='F70'); logavth=log(avth); Proc sort data =Proj4DataNew; by site; /* We use Proc Means to compute the summary stats we need to get the CL's -- and while we're at it, have Proc Means compute the CL's , so we can check our work */ proc means data=Proj4Data N mean stderr CLM Alpha=.05 nway; class site; var logavth; output out= sumstats n=n mean=mean std=std stderr=stderr; /* use a data step to get the CL's -- note the t-inverse function */ data sumstats; set sumstats; df= n-1; UpperCL= mean + stderr * tinv(.975,df); LowerCL= mean + stderr * tinv(.025,df); Run; proc print; /* a data step with a subsetting IF statement to pull out PAIRS of sites for the t-tests*/ data twosites; set timetech; if (site = 'APPLECRK' and prov='F203') or (site = 'MACOUPIN' and prov='F173'); proc ttest data=twosites; class site; var logavth mindiam; run; /* Use GLM to do an (unbalanced) ANOVA on all four sites. We also ask for t-tests on the site means */ proc glm data= Proj4Data; class site; model logavth=site / solution alpha=.05 clparm; lsmeans site / tdiff pdiff alpha=.05 cl; *for bonferroni Adjustment use -- adjust=bon; run;