How to Use PROC REG in SAS (With Example)

Proc Reg in SAS is a procedure used to perform linear regression analysis. It takes the form of dependent and independent variables and provides an output with a regression equation, analysis of variance table, parameter estimates, and other statistical information. An example of how to use Proc Reg is to analyze a dataset with an independent variable, such as price, and a dependent variable such as sales. The regression equation, parameter estimates, and other statistical information can then be used to predict sales based on different prices.


You can use PROC REG in SAS to fit linear regression models.

You can use the following basic syntax to fit a :

proc reg data = my_data;
    model y = x;
run;

This will fit the following linear regression model:

y = b0 + b1x

You can use the following basic syntax to fit a :

proc reg data = my_data;
    model y = x1 x2 x3;
run;

This will fit the following linear regression model:

y = b0 + b1x1 + b2x2 + b3x3

The following example shows how to use PROC REG to fit a simple linear regression model in SAS along with how to interpret the output.

Example: How to Use PROC REG in SAS

Suppose we have the following dataset that contains information on hours studied and final exam score for 15 students in some class:

/*create dataset*/
data exam_data;
    input hours score;
    datalines;
1 64
2 66
4 76
5 73
5 74
6 81
6 83
7 82
8 80
10 88
11 84
11 82
12 91
12 93
14 89
;
run;

/*view dataset*/
proc print data=exam_data;

We can use PROC REG to fit a simple linear regression model to this dataset, using hours as the predictor variable and score as the :

/*fit simple linear regression model*/
proc reg data = exam_data;
   model score = hours;
run;

The first table in the output shows a summary of the model fit:

simple linear regression output in SAS

The Parameter Estimates table contains the coefficient estimates for the model.

From this table we can see the fitted regression equation:

Score = 65.33 + 1.98*(hours)

The PROC REG procedure also produces residual plots that we can use to check if the are met:

Lastly, the PROC REG procedure produces a scatterplot of the raw data with the fitted regression line overlaid on top:

This plot allows us to visually see how well the regression line fits the data.

Note: You can find the complete documentation for PROC REG .

The following tutorials explain how to perform other common tasks in SAS:

x