*
Example 1: Regression of Final on Midterm grade ;
/* It is always good idea to put header for each SAS
program */
/* For example */
/******************************************************
* Example
SAS for a Simple Regression *
* First
Created : May 20, 2007 *
* By:
Prof. S. Kim *
* file location: C:\Class\SAS\example1.sas *
*******************************************************/
/* put all the comments you want in between these
brackets */
* you can also put comments
between * and ; ;
DM "output;clear;log;clear"; *this will
clear output and log windows;
Option linesize=80 pagesize=60 nodate
nonumber; *option to control output appearance;
Title 'Regression on Midterm Grade';
Data Grade;
input midterm final;
Datalines;
68 75
49 63
60 57
68 88
97 88
82 79
59 82
50 73
73 90
39 62
71 70
95 96
61 76
72 75
87 85
40 40
66 74
58 70
58 75
77 72
;
Proc REG Simple;
Model
final=midterm / P;
Output out=Grade P=Pred R=resid;
Run;
Proc Plot;
Plot
final*midterm='*' pred*midterm='p' /overlay;
Plot resid*pred='R' / vref=0;
Run;