BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
YYK273
Obsidian | Level 7

Hello statisticians,

When I run the proc mixed model on longitudinal complex survey data, I found only one of the interaction year_mixed*age (when age=64) is not calculated each time. 

 

proc mixed data=sample;
class PN age (ref='50') ; 
model Score=year_mixed age  year_mixed*age  /solution cl;
random intercept year_mixed/ subject=PN type=un;
weight wt;
run;quit;

In this study, PN is the participant's ID, age is the year of age their scores were measured, and year_mixed is the date the score was measured (a continuous variable). I currently consider age categorical, and the level of PN is 22648, the level of Age is 15, total observation used is 78028 after weight. 

I also tried randomly selecting some small samples n=3000 to run the code the interaction year_mixed*age(64) is still missing and not calculated as I show in the result below.

YYK273_2-1678138251464.png

 

YYK273_1-1678137419237.png

Type 3 Tests of Fixed Effects
EffectNum DFDen DFF ValuePr > F
year_mixed11.90E+040.910.339
age143.70E+043.48<.0001
year_mixed*age133.70E+040.810.65

 

I am wondering why when age=64 the year_mixed*age is not calculated. My other categorical variates work fine, they call can be calculated (Race, Education, Et al.).

I really appreciate your help!

 

Thanks,

Jess

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

This is what SAS does when you have a categorical variable, in this case AGE. At least one, and maybe more, of the levels cannot have a coefficient estimate ... or to say it another way, there isn't enough data to have all coefficients estimated. If (a much simpler case), if you are looking at a class variable that indicates Males or Females, you can only estimate one, and then the other is completely determined and has zero degrees of freedom.

 

What you really really really want to look at is the Least Squares Means in this case, which will indeed have means for all levels. See this explanation.

 

PLEASE DO NOT TYPE IN ALL CAPITALS.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

This is what SAS does when you have a categorical variable, in this case AGE. At least one, and maybe more, of the levels cannot have a coefficient estimate ... or to say it another way, there isn't enough data to have all coefficients estimated. If (a much simpler case), if you are looking at a class variable that indicates Males or Females, you can only estimate one, and then the other is completely determined and has zero degrees of freedom.

 

What you really really really want to look at is the Least Squares Means in this case, which will indeed have means for all levels. See this explanation.

 

PLEASE DO NOT TYPE IN ALL CAPITALS.

--
Paige Miller
YYK273
Obsidian | Level 7

Hi Paige,

I really appreciate your reply and help. Your solution works and is very helpful!

However, in my interaction year_mixed*age, year_mixed is a continuous variable, and SAS reported ERROR: Only CLASS variables allowed in this effect. This is my code:

proc mixed data=sample;
class PN age (ref='50') ; 
model Score=year_mixed age  year_mixed*age  /solution cl;
random intercept year_mixed/ subject=PN type=un;
weight wt;
LSMEANS year_mixed*age/diff;
run;quit;

How should I handle the interaction with a continuous variable? It seems that LSMEANS does not work with continuous variables.

 

I really appreciate your time and help. Also, thank you so much for your reminder and I have changed my title. 

 

 

 

jiltao
SAS Super FREQ

There might be some confounding in your data and that is why in addition to age 50, you get a zero estimate for age 64. To see if that is the case, you might run the following program and examine the E option output -

proc glm data=sample;
class PN age (ref='50') ; 
model Score=year_mixed age  year_mixed*age  / e;
weight wt;
run;
quit;

Thanks,

Jill

YYK273
Obsidian | Level 7

Hi Jill,

Thank you so much for your helpful reply! It's very informative.

 

Best,

Jess

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 744 views
  • 1 like
  • 3 in conversation