SAS PROGRAMMING HANDOUT #13 INSIGHT#2 This handout covers using SAS INSIGHT to perform regression. You can enter data into the spreadsheet manually by selecting NEW at the first window Or you can create a permanent SAS data set in a subdirectory. If you create a permanent SAS data set in a subdirectory, you need to run a program from the PGM window naming the directory using the 'libname' command. For illustration purposes we will select the RETAIL data set from the SASHELP library. A spreadsheet looking window will appear showing the data. The data can be changed by clicking on an observation and typeing in the new value. Select the FIT[YX] option. Select SALES as the Y-variable and DATE as the X-variable. The GROUP variable acts as a BY variable. Select the OUTPUT icon. Select the RESIDUAL NORMAL QQ-plot. Select the APPLY icon This will plot the data with the linear regression line, perform linear regression do a residual plot, and do a normal probability plot. It will also add the residual and predicted values to the data set. You can see how higher order polynomial regression models 'fit' the data by increasing the degree of the polynomial. You can see whether transformations inprove the fit by clicking on a variable (say SALARY) in the "first box', then clicking on the EDIT icon, and selecting VARIABLES, and the selecting a suitable transformation, eg, log-transform Y. This change the analysis (using log(Y) instead of Y), and it will add log(Y) to the data set. You can see what effect deleting an observation has, by clicking (control click-to delete several observations. Then click on the EDIT icon, and select OBSERVATIONS, and the selecting EXCLUDE. SAS will redo the analysis excluding any observations that have been excluded. This is very useful if you have 'outlyers'. In order to print select EDIT, then WINDOWS, then SELECT ALL, and the selecting the print icon. Or you can Control-click on the edges of the boxes that you want to have printed off. If SAS asks you for a device type respond WINPRTM. INSIGHT can also be used to perform logistic or Poisson regression. Select the METHOD icon. By selecting binomial distribution, and the conanical link (or logit) you will be performing logistic regression as long as your Y variable is a 0/1 variable. Selecting the Poisson distribution and conanical link (or log) yields Poisson reg.