data diet; infile '~/WWW/stat401/data/case0501.txt'; input lifetime trt $; /* calculate mean, std and stderr for each group of obs */ proc means n nobs mean std stderr; class trt; var lifetime; /* simple use of proc glm - just compute anova table and test equality */ /* report means and s.e. based on pooled s.d. */ proc glm; class trt; model lifetime = trt; lsmeans trt /stderr; /* slightly more complicated - output residuals and plot diagnostics */ proc glm; class trt; model lifetime = trt; output out=resids p = yhat r = resid; proc print data = resids(obs = 10); /* N.B. not needed if all you want is the residual plot */ /* a lineprinter plot */ proc plot; plot resid*yhat; title 'Predicted vs residual plot'; /* a high-resolution plot */ proc gplot; plot resid*yhat; title 'Predicted vs residual plot'; /* finally restrict the analysis to certain observations */ proc glm data = diet; /* where trt = 'lopro'; */ where trt in ('N/R40','N/R50','lopro'); class trt; model lifetime = trt; lsmeans trt /stderr; run;