Hello,
I am curious how 3 variables in the absorb statement would break down in a proc glm. For example, according to the sas docs the below are equivalent:
proc glm;
absorb herd cow;
class a b;
model y=a b a*b;
run;
proc glm;
class herd cow a b;
model y=herd cow(herd) a b a*b;
run;
The docs also state that for the Absorb statement: Several variables can be specified, in which case each one is assumed to be nested in the preceding variable
in the ABSORB statement.
So would the below then be equivalent?
proc glm;
absorb herd cow staff;
class a b;
model y=a b a*b;
run;
proc glm;
class herd cow staff a b;
model y=herd cow(herd) staff(herd) staff(cow) a b a*b;
run;
What did you get for output? That is often a real easy way to see if two things are equivalent.
I think you need to read the documentation closely. Specifically:
Several variables can be specified, in which case each one is assumed to be nested in the preceding variable in the ABSORB statement.
So since you have changing order in your staff(herd) (herd is not the preceding variable for staff) very likely not.
I have an equation with 5 absorption variables.. So I can't really "check" them because I wouldn't know how to create the equation that doesn't use the "Absorb" statement. Also, I read the methodology carefully, I was just basing this off the example the docs give, which you can see in my opening questions. You should read that more carefully.
As to checking whether results are equivalent, you don't have to do 5 variables - just any number more than 2. I don't know, maybe 3? You could then explicitly check your conjecture, using the syntax you suggested.
But ..., the phrase "nested in the preceding variable [note singular case] in the ABSORB statement" taken literally, would suggest that
proc glm;
absorb herd cow staff;
model y=a b a*b;
run;
is NOT equivalent to
proc glm;
class herd cow staff a b;
model y=herd cow(herd) staff(herd) staff(cow) a b a*b;
run;
I would interpret the text of the quoted documentation to mean the equivalent would be:
proc glm;
class herd cow staff a b;
model y=herd cow(herd) staff(cow) a b a*b;
run;
although this disturbs me, since I don't see how it accommodates staff*herd interaction (which your suggestion does), nor herd*staff*cow.
Perhaps the absorb herd cow staff; statement is really equivalent to
proc glm;
class herd cow staff a b;
model y=herd cow*herd staff*cow*herd a b a*b;
run;
This latter model doesn't ask for estimates of the main effects of cow or staff, nor the cow*staff or herd*staff interactions. But they are essentially nuisance parameters for your purposes. I think the cow main effect would be "absorbed" in the specified cow*herd estimate. Similarly the staff main effect, the staff*cow interaction, and the staff*herd interaction would all be absorbed in the staff*cow*herd interaction. However, this is just speculation on my part, but testable. If I'm right, though, then the equivalent for absorbing 5 variables (call them M, N, O, P, and Q) would be:
proc glm;
class M N O P Q A B;
model y= M N*M O*N*M P*O*N*M Q*P*O*N*M A B A*B;
run;
I would appreciate comments from any of our experienced statistics practitioners.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.