/* arsenic1.sas */ data arsenic; input conc dist; cards; 3.19 2 3.26 4 1.82 8 1.02 10 1.85 12 2.05 15 1.34 21 .79 23 .66 30 .30 36 ; proc print data=arsenic; title 'arsenic data'; proc sgscatter data=arsenic; plot conc*dist; title 'regression of conc on dist (1)'; proc glm data=arsenic plots = (residuals); model conc = dist / ss1 ss2 p clm clparm ; output out=new predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; estimate 'intercept' intercept 1; estimate 'slope' dist 1; estimate 'mean' intercept 1 dist 16.1; estimate 'meanresp20' intercept 1 dist 20 / e; title 'regression of conc on dist (1)'; proc print data=new; var conc dist clml clmu clpl clpu yhat resid; proc univariate data=new plot normal nextrval=5; var resid; ods select BasicMeasures TestsForNormality ExtremeValues Quantiles; title 'descriptive statistics for residuals'; run; /* ------------------------------------------------------ */ /* append x=20 to get prediction interval */ data dist20; input conc dist; cards; . 20 ; data combine1; set arsenic dist20; proc glm data=combine1 plots=none; model conc = dist; output out=new1a predicted=yhat residual=resid lcl=clpl ucl=clpu lclm=clml uclm=clmu; title 'regression of conc on dist (2) prediction interval for x=20'; proc print data=new1a; var conc dist clml clmu clpl clpu yhat resid; run; /* ------------------------------------------------------ */ /* get the ANOVA with the uncorrected total SS */ proc glm data=arsenic plots=none; model conc = dist / ss1 ss2 intercept; title 'regression of conc on dist (3) ANOVA with uncorrected total SS'; run; proc glm data=arsenic; model conc=dist; title 'regression of conc on dist (4) Standard output from proc glm'; run; proc reg data=arsenic; model conc=dist; title 'regression of conc on dist (5) Standard output from proc reg'; run;