Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Plain vanilla OLS with fixed effects

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-16-2008 07:57 PM

I want to run a simple OLS regression with fixed effects. (i.e. y= a b c, with fixed effects on d). I've been using proc mixed, but I am more comfortable with the output from traditional OLS like proc reg, which I don't believe supports fixed effects. The help menu is so complex. Any simple ideas?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

10-20-2008 08:46 AM

If you are using the standard definition of a fixed effect, then PROC REG certainly does work on fixed effects. PROC REG does not work on random effects.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Paige

10-21-2008 02:04 PM

Short of creating a dummy variable for every occurance of the fixed effect (over 100), what are my options for running OLS with fixed effects? With PROC MIXED, I use a class statement, but that is not available on PROC REG. I see that PROC VARCOMP has a class statement, but I have not been successful in implementing it. There must be an easy way to do this that I'm missing. Alternativly, is there any way to get an R2 out of PROC MIXED? Thanks.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

10-21-2008 02:17 PM

Ah, terminology.

I call what you are talking about a CLASS (or classification) effect, not a fixed effect.

Your choices are PROC GLM or PROC MIXED. Both use CLASS statements. PROC GLM provides R-squared values, PROC MIXED does not. PROC MIXED uses maximum likelihood estimation, whereas PROC GLM uses least squares estimation (in some cases, least squares and maximum likelihood will give the same answers).

I call what you are talking about a CLASS (or classification) effect, not a fixed effect.

Your choices are PROC GLM or PROC MIXED. Both use CLASS statements. PROC GLM provides R-squared values, PROC MIXED does not. PROC MIXED uses maximum likelihood estimation, whereas PROC GLM uses least squares estimation (in some cases, least squares and maximum likelihood will give the same answers).

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Paige

10-23-2008 03:02 AM

Dear Paige:

I am a new user for SAS. I have some questions about fixed-effect in SAS program and I found your answers from the Yahoo searching.

Q1: You were saying that "PROC REG certainly does work on fixed effects". If I want to get the INVEST EFFICIENCY(y) and SALE(x1) / ASSET(x2) fixed effect regression for the different companies (COMPANY) and years (YEAR), could you please show me the detail codes?

(like: PROC REG DATA=a1???????;m1 model= y= x1 x2?????)

Q2:if some companies do not have one of variables (x1 or x2), will it be deleted during the calculation.

Thank you

NEW USEr

I am a new user for SAS. I have some questions about fixed-effect in SAS program and I found your answers from the Yahoo searching.

Q1: You were saying that "PROC REG certainly does work on fixed effects". If I want to get the INVEST EFFICIENCY(y) and SALE(x1) / ASSET(x2) fixed effect regression for the different companies (COMPANY) and years (YEAR), could you please show me the detail codes?

(like: PROC REG DATA=a1???????;m1 model= y= x1 x2?????)

Q2:if some companies do not have one of variables (x1 or x2), will it be deleted during the calculation.

Thank you

NEW USEr

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

10-23-2008 08:11 AM

In general, I don't write code for other people. However, if you try something and you can't figure out why it isn't working, I would be happy to help.

Furthermore, your description of the problem is somewhat vague. I don't know how your data is structured, and its not clear to me what you mean by "... for the different companies (COMPANY) and years (YEAR)".

Furthermore, your description of the problem is somewhat vague. I don't know how your data is structured, and its not clear to me what you mean by "... for the different companies (COMPANY) and years (YEAR)".

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Paige

10-23-2008 09:07 AM

I would like to run the fixed-effect regression. First of all, I need to calculate the average values of the sale, asset and invest of different years for company AAA. Then do the same thing for companies BBB and CCC. Next, each original value minuses the average value, then the differences are used to run the regression. That is fixed-effect regression, right?

Year company sale asset invest

1991 AAA 23 56 3.2

1992 AAA 25 68 3.5

1993 AAA 22 45 4.2

1992 BBB 32 43 6.2

1991 CCC 1002 256 12.2

1992 CCC 1032 246 13.5

1993 CCC 1042 276 16.5

I learn from the SAS manual to write the following codes. But I do not know whether it is correct or not?

PROC GLM data=p1;

ABSORB company;

CLASS year;

MODEL invest= sale asset year/SOLUTION;

OUTPUT OUT=p2;

RUN; QUIT;

Q1: The above codes are correct, aren’t they?

Q2; I want to output the final regression results (including the R-square, F-values etc.) to one file(p2). However, the file (p2) resulted from the above procedure (codes) are the new DATA set. How do get the regression result (including the R-square, F-values etc.) which I want?

Q3. if some companies do not have one of variables (sale or asset), will it be deleted during the calculation,

Thank you

NEW USER (from Taiwan)

Year company sale asset invest

1991 AAA 23 56 3.2

1992 AAA 25 68 3.5

1993 AAA 22 45 4.2

1992 BBB 32 43 6.2

1991 CCC 1002 256 12.2

1992 CCC 1032 246 13.5

1993 CCC 1042 276 16.5

I learn from the SAS manual to write the following codes. But I do not know whether it is correct or not?

PROC GLM data=p1;

ABSORB company;

CLASS year;

MODEL invest= sale asset year/SOLUTION;

OUTPUT OUT=p2;

RUN; QUIT;

Q1: The above codes are correct, aren’t they?

Q2; I want to output the final regression results (including the R-square, F-values etc.) to one file(p2). However, the file (p2) resulted from the above procedure (codes) are the new DATA set. How do get the regression result (including the R-square, F-values etc.) which I want?

Q3. if some companies do not have one of variables (sale or asset), will it be deleted during the calculation,

Thank you

NEW USER (from Taiwan)

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to deleted_user

11-03-2008 03:46 PM

A1: Looks good to me. Did you try it? Does it work for you?

A2: You need to use the ODS OUTPUT statement to get these statistics. SAS Help specifies the table names you would want to choose to get certain statistics.

A3: The entire row is not used if any of the input or output variables is missing.

A2: You need to use the ODS OUTPUT statement to get these statistics. SAS Help specifies the table names you would want to choose to get certain statistics.

A3: The entire row is not used if any of the input or output variables is missing.