Hi all,
I have been running a proc mixed model with two categorical variables of interest: sex and state.
IF state="technical missing" then state_cat='0';
IF state="not alive" then state_cat='1';
IF state="alive" then state_cat='2';
PROC MIXED DATA=P21_ METHOD=REML;
TITLE "Outcome: P21, Exposure:sex";
CLASS state (REF='0') days_cat sex (REF='0');
MODEL p21=sex days sex*days state / SOLUTION CL;
REPEATED days_cat / SUBJECT=subject TYPE=SP(pow)(days_cat);
/*RANDOM days int / sub=subject;*/
RUN;
I have three levels of the "state" variable, however the results produced don't have any estimates for the state variable. Why could this be? State "2" is in the model, however everything is blank. I had no issues with the variable sex, where 0 (male) is the reference.
P.S. I renamed the state_cat variable to state which is why state is being used in the mixed model.
Thanks in advance!
Sara
You cannot get coefficient estimates for a variable that has only 1 level.
This happens because you don't have enough data in your study to estimate all model terms. You either need more data, or you need to remove terms from the model.
Also, unrelated to the above, this piece of code doesn't seem to be useful, you normally don't want to replace meaningful words with non-meaningful numbers, this just makes the output harder to read and harder to understand.
IF state="technical missing" then state_cat='0';
IF state="not alive" then state_cat='1';
IF state="alive" then state_cat='2';
This model would only run where p21 is not equal to missing, correct? Since that is the outcome.
I ran this code:
proc freq;
where p21 ne .;
tables state;
run;
This was the output:
So, I guess it must be because everyone is being classified in the same category and there is nothing to compare.
You cannot get coefficient estimates for a variable that has only 1 level.
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.
Ready to level-up your skills? Choose your own adventure.