Solved
Contributor
Posts: 58

# Proc reg and reference groups

Dataset

IDYX1 (Categorical)X2 (categorical)
18521
215645
37818
445639

1) I think by default, proc reg selects the lowest values as the reference variable right? In this case the reference value of X1/X2 will be 1.  If I were to run:

```Proc reg data=have;
model y=x1 x2;
run;
```

2) If I wanted the reference value to be 2 for the X1 variable, how do I do it?

Accepted Solutions
Solution
‎01-09-2015 09:19 AM
Posts: 2,055

## Re: Proc reg and reference groups

You can't use character or categorical variables in the model statement of PROC REG.

If you want to do this in PROC GLM, the last value alphabetically will have it's coefficient set to zero. Which in general is pretty irrelevant since you can use the TEST or ESTIMATE statement to compare level 2 to any (combination of) other levels.

I assume your actual data set contains more than the 4 observations shown.

--
Paige Miller

All Replies
Solution
‎01-09-2015 09:19 AM
Posts: 2,055

## Re: Proc reg and reference groups

You can't use character or categorical variables in the model statement of PROC REG.

If you want to do this in PROC GLM, the last value alphabetically will have it's coefficient set to zero. Which in general is pretty irrelevant since you can use the TEST or ESTIMATE statement to compare level 2 to any (combination of) other levels.

I assume your actual data set contains more than the 4 observations shown.

--
Paige Miller
Contributor
Posts: 58

## Re: Proc reg and reference groups

Thanks I'll look into Proc GLM. Yes there is more than 4 observations in my dataset shown

Can I use the class statement to set the reference value for Proc GLM?

Posts: 2,055

## Re: Proc reg and reference groups

You would use the TEST or ESTIMATE statements to compare level 2 to any other level.

Or you can specify the level you want to have coefficient of zero in the CLASS statement.

--
Paige Miller
SAS Employee
Posts: 308

## Re: Proc reg and reference groups

Yes, you can set the reference level for CLASS variables in PROC GLM (beginning in SAS 9.3 TS1M2).  See this note about setting reference levels.

🔒 This topic is solved and locked.