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
- /
- SAS Programming
- /
- General Programming
- /
- Fixed Effects Regression

Topic Options

- 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

06-12-2014 09:50 AM

Hi,

Which is the proper way to run a fixed effect regression: proc reg or proc panel?

I have the following variables in my dataset: companyISIN, year, car, mv, ta, roa, ni, dy etc. car will be dependent variable and all other variables (except companyISIN and year) are independent variables.

For OLS regression, I run the following codes:

proc reg data = x;

model car = mv ta roa ni dy;

output out = fittedvals predicted fitted;

run;

Please correct me if there are mistakes here.

But for the fixed effects or random effects model, I run the following codes but it does not work:

proc panel data = x;

model car = mv ta roa ni dy / fixone;

id CompanyISIN year;

run;

I also would like to run the GMM model. How can I do all of these?

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

Posted in reply to AbuChowdhury

06-12-2014 09:59 AM

You can try proc glm for fixed effect and proc mixed for random effects.

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

Posted in reply to AbuChowdhury

06-12-2014 10:01 AM

You can try proc glm for fixed effect and proc mixed for random effects.

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

Posted in reply to Ksharp

06-12-2014 10:24 AM

Hi,

would you please write the codes? I am not familiar with these procs.

I am including the data file. I also need to do the log of mv variable and roa/100. So the dependent variable will be car5 and independent variables will be bm, log of mv, roa/100, and dy.

In the regression, there will be two fixed effects: firm (i.e. companyISIN) and year.

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

Posted in reply to AbuChowdhury

06-12-2014 11:48 AM

Both procedures have tons of worked out examples in the documentation. It almost always works out better if you code it yourself, and if it doesn't work, ask for help then. Also, search the archives of the Statistical Procedures forum (for GLM and MIXED). There are hundereds of examples of code there

Examples of PROC PANEL code are available both in the documentation and in the Forcasting and Econometrics forum.

Steve Denham

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

Posted in reply to Ksharp

06-13-2014 03:17 PM

Hi Xia,

I am also waiting for your reply. Thanks.

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

Posted in reply to AbuChowdhury

06-14-2014 09:09 AM

Sorry. Currently I am learning Statistical theory ,although I have some statistical background in my university . But I can't offer you more information. Doc Steve is expert about it. Maybe you should ask him more questions.

Xia Keshan

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

Posted in reply to Ksharp

06-16-2014 08:15 AM

Abu, see my remarks upstream. There are many examples in the documentation for both procedures. What sort of errors occurred in the PROC PANEL run? Please list them.

Steve Denham

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

Posted in reply to SteveDenham

06-17-2014 06:24 AM

Hi Steve,

Proc panel works if I delete all blank observations. If there is any blank observation for any variable, then it does not work. Is it the case for proc panel?

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

Posted in reply to AbuChowdhury

06-17-2014 07:24 AM

Not real sure of your meaning "it does not work." According to the documentation: Any observation in the input data set with a missing value for one or more of the regressors is ignored by PROC PANEL, and is not used in the model fit. The same is true of the other fixed effects regression packages in SAS, such as REG or GLM. No matter what you do, in these procedures, those observations will be excluded. This is especially frustrating for time series analysis

What can be done? Imputation, such as PROC MI, then PROC PANEL by imputation number, then PROC MIANALYZE is one way. PROC EXPAND for time series data is a second Random effects regression is another, if the data are at least missing at random.

Steve Denham

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

Posted in reply to SteveDenham

06-17-2014 08:21 AM

It does not work means it shows the error messages such as:

ERROR: Each observation for time point CompanyISIN=US01988P1084 has a missing value for at least

one variable in MODEL statement .

NOTE: The SAS System stopped processing this step because of errors.

Other procedures such as proc reg or proc glm exclude the missing observations and show the results, but if there is any missing observation and if I submit the proc panel, then it does not run and hence it does not show the results, rather processing has been stopped (the above error message).

But if I delete all missing observations for all variables then proc panel works and shows the results.

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

Posted in reply to AbuChowdhury

06-17-2014 08:53 AM

Ahh. The two-way (company*time) comes up missing and so PANEL will stop. However, if you delete all missing observations, the time series will not be aligned correctly for the time series by company. I would find any values obtained to be suspect. I would strongly encourage the use of PROC EXPAND to impute the missing values in each company's time series as a first step, and then proceed to use PROC PANEL.

Steve Denham

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

Posted in reply to SteveDenham

06-17-2014 09:12 AM

Thanks but what codes should I write in proc expand? I will be grateful if you tell me.

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

Posted in reply to AbuChowdhury

06-17-2014 09:17 AM

I will be upfront on this--I have never done it, so have no code to share. Search the Econometrics and Forecasting forum, as well as the Procedures forum. Many other people have posted on how to implement PROC EXPAND--that is how I knew of it.

Steve Denham

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

Posted in reply to SteveDenham

06-17-2014 10:34 AM

Hello -

As pointed out replacing missing values will be needed, but of course there are many ways how to go about this.

One way is to use PROC EXPAND to interpolate missing values: http://support.sas.com/documentation/cdl/en/etsug/66840/HTML/default/viewer.htm#etsug_expand_getting...

Another way might be to replace the missing values with a fixed values such as a numeric (0), mean, max, min, etc.

PROC TIMESERIES allows you to do that - see setmissing option of ID statement for example: http://support.sas.com/documentation/cdl/en/etsug/66840/HTML/default/viewer.htm#etsug_timeseries_exa...

Thanks,

Udo