/* read the input data set */
Data
new ;
Set
sashelp.shoes ;
if
product='Boot' ;
run ;
/*
print the data */
proc print
data=new ;
run ;
/*
create a scatter plot of sales vs. inventory */
proc plot
data=new ;
plot
sales*inventory ;
run ;
/*
run a regression of sales on inventory */
/*
compute the confidence interval (CLM) and prediction interval (CLI) */
/*
output the residuals and predicted values to a new data set called resid1 */
proc reg data=new
;
model
sales=inventory / clm
cli ;
output
out=resid1 r=res p=pred;
run ;
/*
create a residual plot */
proc plot
data=resid1 ;
plot
res*pred ;
run ;
/*
use proc univariate to examine the residuals and
create a box plot */
proc univariate
data=resid1 plots
;
var
res ;
run ;
/*
delete the outlier from the data set */
data new2 ;
set
new ;
if
inventory>700000 then
delete ;
run ;
/*
re-plot the data without the outlier */
proc plot
data=new2 ;
plot
sales*inventory ;
run ;
/*
re-run the regression analysis without the outlier */
proc reg data=new2
;
model
sales=inventory / clm
cli ;
output out=resid2
r=res p=pred;
run ;
/*
create a new residual plot */
proc plot
data=resid2 ;
plot
res*pred ;
run ;
quit ;