SlideShare a Scribd company logo
1 of 9
REG procedure:
Simple linear regression
         2013.03.14
Syntax
PROC REG <options> ;
     MODEL dependents=<regressors> < / options > ;
     PLOT <yvariable*xvariable> <=symbol> <...yvariable*xvariable> <=symbol> </ options> ;
RUN;
Syntax
PROC REG <options> ;
     MODEL dependents=<regressors> < / options > ;
     PLOT <yvariable*xvariable> <=symbol> <...yvariable*xvariable> <=symbol> </ options> ;
RUN;


• y=x
• weight = age height
Syntax
PROC REG <options> ;
     MODEL dependents=<regressors> < / options > ;
     PLOT <yvariable*xvariable> <=symbol> <...yvariable*xvariable> <=symbol> </ options> ;
RUN;
Variable names
Keywords
Example
data example1;
do i=1 to 200;
        x=10*rannor(100);
        y=x+10*rannor(3);
        output;
end;
drop i;
;

proc reg;
model y=x;
run;
Output
Output: Residual diagnosis
Example
data example1;
do i=1 to 200;
          x=10*rannor(100);
          y=x+10*rannor(3);
          output;
end;
drop i;
;

proc reg CORR;
model y=x/CLM CLI CLB;
plot residual.*predicted. y*x;
run;
Example
data example1;
do i=1 to 200;
          x=10*rannor(100);
          y=x+10*rannor(3);
          output;
end;
drop i;
;

proc reg CORR;
model y=x/CLM CLI CLB;
plot residual.*predicted. y*x;
run;

More Related Content

More from WenSheng Chang (12)

Sas plot
Sas plotSas plot
Sas plot
 
1129 sas實習課
1129 sas實習課1129 sas實習課
1129 sas實習課
 
Sas tutorial 1018
Sas tutorial 1018Sas tutorial 1018
Sas tutorial 1018
 
Sas tutorial 0524
Sas tutorial 0524Sas tutorial 0524
Sas tutorial 0524
 
Sas tutorial glm2
Sas tutorial glm2Sas tutorial glm2
Sas tutorial glm2
 
Sas tutorial glm1
Sas tutorial glm1Sas tutorial glm1
Sas tutorial glm1
 
Regression ci
Regression ciRegression ci
Regression ci
 
SAS 0412
SAS 0412SAS 0412
SAS 0412
 
Sas tutorial 0308
Sas tutorial 0308Sas tutorial 0308
Sas tutorial 0308
 
Sas tutorial 0308
Sas tutorial 0308Sas tutorial 0308
Sas tutorial 0308
 
0925 sas實習課
0925 sas實習課0925 sas實習課
0925 sas實習課
 
Science p79 -- polished
Science p79 -- polishedScience p79 -- polished
Science p79 -- polished
 

Sas reg simple