BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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?
7 REPLIES 7
Paige
Quartz | Level 8
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.
deleted_user
Not applicable
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.
Paige
Quartz | Level 8
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).
deleted_user
Not applicable
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
Paige
Quartz | Level 8
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)".
deleted_user
Not applicable
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)
Paige
Quartz | Level 8
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1022 views
  • 0 likes
  • 2 in conversation