turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Fixed effect regressions

Topic Options

- Subscribe to 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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-22-2014 02:28 AM

Hi all,

I want to run a regression between annual expense and sales, including a fixed effect for each firm (firm_code).

I came across the codes:

proc glm;

absorb firm_code;

model expense = sales / solution noint;

run;

quit;

However, I am using a panel data including 4 years of observations for each firm. This means for each firm (firm_code) there will be four observations of expense and sales.

As a result, I only need to create on dummy variable for each firm, I am not sure whether the command "absorb" does that, or does it create a dummy variable for every line of observation for firm?

If there is any better ways of running fixed effects regression, please tell me

Thank you in advance!

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

Posted in reply to miguel_valero

08-22-2014 08:53 AM

Actually, you don't have to create a dummy variable for each firm, just be certain that the dataset is sorted by firm_code. GLM will automatically nest the observations within firm_code, and perform the regression. And provided you don't need predicted values or regression diagnostics, you get all this with a marked reduction in overhead computational resources.

Now if you want a regression for EACH firm_code (sort of implied in the first line of your post), either a BY statement or something like:

proc glm;

class firm_code;

model model expense = sales|firm_code / solution noint;

quit;

This would give separate intercepts and slopes for each firm_code, but assumes common residual variance across firm_codes

Steve Denham

Message was edited by: Steve Denham

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

Posted in reply to SteveDenham

08-22-2014 06:29 PM

Hi Steve,

Sorry for the misunderstanding. I have a panel of annual data for different firms over several years of time. I just need to run **one** regression for the entire panel. However, I do need to control for firm fixed effect for each individual firm (presumably by adding a dummy variable for each firm - e.g. dummy A equals to 1 for firm A 2010, 2011, and 2012).

Thank you for your help!

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

Posted in reply to miguel_valero

08-25-2014 07:34 AM

Then ABSORB looks like your best tool to accomplish that.

Steve Denham

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

Posted in reply to SteveDenham

3 weeks ago

@SteveDenhamCurrently I am doing exactly what you have mentioned. I am trying to run fixed effect regression. In first step I need to run regression on every firm-year (each year of each firm individually) and then using the intercept of that regression in second regression.

I tried to run your code:

proc glm;

class firm_code;

model model expense = sales|firm_code / solution noint;

quit;

I guess writing model two times was unintentional. So I change you codes as follow;

proc glm data=dtab2;

class count; ** where count is unique number for each firm year;*

model exret = Mktrf | count / solution noint; **where exret=excess return, Mktrf=Market return;*

output out=xglm p=predicted;

quit;

Results show this error

ERROR: Number of levels for some effects > 32767.

Also I tried to run proc reg/proc panel/proc tscs/ but the problem is:

if I don't specify by variable, I get reg output of whole model as one (row) observation having intercept and coefficient for all firms

if I specify by variable for both time series (macc=unique for each time obs) and cross-sectional (permno) variable, it seems my model is over specified,

>proc reg give infinite error for each firm-year (number of nonmissing values are ....)

>proc panel give error (Event Stack Underflow caused by mis-matched begin and end event call in SAS)

if I reg by count(proc reg data=dtab2 outest=xreg noprint; by count; model exret = Mktrf / adjrsq; quit then beta & RMSE ave no values and intercept are generated exactly of similar value as exret (dep variable) itself.

Kindly suggest me any solution to this problem.

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

Posted in reply to miguel_valero

2 weeks ago

Paul Allison has a wonderful book on fitting fixed effects models of various types - ordinary regression (normal response), logistic, Poisson, and survival (Cox) models. Here is the reference and a link to it:

Fixed Effects Regression Methods for Longitudinal Data Using SAS (Allison, P., SAS Institute, 2005)