options ls=80 ps=65; title1 'Diagnostics Example'; /* Read in the data set */ data one; infile 'c:\saswork\data\tensile.dat'; input percent strength time; /* Perform ANOVA, test equal variances (hovtest=), store residuals and predicted values in a SAS data set called diag */ proc glm data=one; class percent; model strength=percent; means percent / hovtest=bartlett hovtest=levene; output out=diag p=pred r=res; /* Generate a residual plot */ proc sort; by pred; symbol1 v=circle i=sm50; title1 'Residual Plot'; proc gplot; plot res*pred/frame; run; /* Generate a QQ-plot and histogram */ proc univariate data=diag noprint; var res; qqplot res / normal (L=1 mu=est sigma=est); histogram res / normal; run; run; /* Plot residuals vs time to see if there is a pattern. Will use different smoothing levels */ proc sort; by time; symbol1 v=circle i=sm75; title1 'Plot of residuals vs time'; proc gplot; plot res*time / vref=0 vaxis=-6 to 6 by 1; run; symbol1 v=circle i=sm50; title1 'Plot of residuals vs time'; proc gplot; plot res*time / vref=0 vaxis=-6 to 6 by 1; run;