BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

I use class in proc glm to run a one-way fixed-effect model as follows.

data have;
do i=1 to 3;
do j=1 to 3;
do k=1 to 10;
x=rannor(1);
y=x+rannor(1);
output;
end;
end;
end;
run;

proc glm data=have;
class i;
model y=x i/noint solution;
ods output parameterestimates=oneway_class;
quit;

Or sometimes I use absorb because it is faster than class.

proc glm data=have;
absorb i;
model y=x/noint solution;
ods output parameterestimates=oneway_absorb;
quit;

And I found that absorb, unlike class, cannot estimate a two-way fixed-effect model in this way.

/*THE FOLLOWING ESTIMATES TWO-WAY FIXED-EFFECT MODELS CORRECTLY*/
proc glm data=have;
class i j;
model y=x i j/noint solution;
ods output parameterestimates=twoway_class;
quit;

/*THE FOLLOWING DOES NOT ESTIMATE TWO-WAY FIXED-EFFECT MODELS*/
proc glm data=have;
absorb i j;
model y=x/noint solution;
ods output parameterestimates=twoway_absorb;
quit;

Though the first glm with class is correct, it becomes too slow because the real data have so many observations. How can I estimate a two-way fixed-effect model with absorb in glm instead?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Correct.

 

If you use the ABSORB statement with two variables, ABSORB assumes that the second variable in the list is nested within the first, and this is not the design you have.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Correct.

 

If you use the ABSORB statement with two variables, ABSORB assumes that the second variable in the list is nested within the first, and this is not the design you have.

--
Paige Miller
Junyong
Pyrite | Level 9

Thanks. Then should I give up the absorb approach for two-way fixed effects?

PaigeMiller
Diamond | Level 26

@Junyong wrote:

Thanks. Then should I give up the absorb approach for two-way fixed effects?


I would replace the word "should" with "must"

--
Paige Miller
Junyong
Pyrite | Level 9

Sad news since LSDV-estimating multi-way fixed-effect models is computationally costly, but thanks anyway.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 892 views
  • 0 likes
  • 2 in conversation