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

Hi ,

 

I am new to proc mixed and I am having trouble getting my estimate statements to work. I'm modeling 2   3-level (with values 0,1,2) categorical variables (kcaltert and recentkcaltert) and their interaction on a continuous variable (logisopng_ml). I am not able to get my estimate statements to produce an estimate. For example, below I am trying to look at in effect of recentkcaltert=2 vs 0 amongst people with kcaltert=2. 

 

proc mixed data=work.isopfinal2 method=reml covtest;
class Pt_number kcaltert (ref='0') recentkcaltert(ref='0') ;
model logisopng_ml= kcaltert recentkcaltert kcaltert*recentkcaltert /s;
random intercept /sub=pt_number Type=UN G;
estimate 'recentkcaltert=2 vs 0 amongst kcaltert=2' intercept 0 kcaltert 0 0 0 recentkcaltert 0 1 0 kcaltert*recentkcaltert 0 0 0 1/e;
run;

 

 

 

I'm not sure my zeros are correct for the interaction term; help with this would be appreciated.  But even when I just remove the interaction from the estimate, I am unable to get an estimate. Can someone help me understand my mistake?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Backing up to look at the problem from a broader viewpoint:

 

ESTIMATE statements are hard to get right except in the simplest of cases, but they were designed to allow you to estimate general linear combinations of your levels, such as

 

a*(recentkcaltert=0) + b*(recentkcaltert=1) + c*(recentkcaltert=2)

 

for any values of a, b or c that are allowable (estimable) based upon the data.

 

But you want a simpler comparison, where you are comparing one level to another level. This can be done easily via the LSMEANS command, where SAS has done the hard work to get the right comparisons, so you don't have to do that work in the ESTIMATE command. So in the case where the goal is to compare the means of one level to the means of another level, the ESTIMATE command is not the right tool (in the sense that it is more complicated to use and to get the right answer) whereas the LSMEANS command is the right tool, its much simpler to use.

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@wmckvr wrote:

I am new to proc mixed and I am having trouble getting my estimate statements to work. I'm modeling 2   3-level (with values 0,1,2) categorical variables (kcaltert and recentkcaltert) and their interaction on a continuous variable (logisopng_ml). I am not able to get my estimate statements to produce an estimate. For example, below I am trying to look at in effect of recentkcaltert=2 vs 0 amongst people with kcaltert=2. 

 


What is the evidence that it isn't working? Show us the LOG. Show us the output.


In general when ESTIMATE statements don't work, it is because the specific estimate you have chosen is not estimable.


Does this explanation help at all? https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_introglmest_sect015.htm&docsetVer...

 

 

--
Paige Miller
wmckvr
Calcite | Level 5

Hi Paige,

 

Thank you for your response. Attached is the output with the log beneath.

 

Liam

PaigeMiller
Diamond | Level 26

Most of us will not (or cannot) open Microsoft Office documents from the web, because they are a security threat.


Also, If I am understanding your problem correctly, I think you could use the SLICE= option and the DIFF option of the LSMEANS statement to obtain the comparison you are interested in.

--
Paige Miller
PaigeMiller
Diamond | Level 26

Backing up to look at the problem from a broader viewpoint:

 

ESTIMATE statements are hard to get right except in the simplest of cases, but they were designed to allow you to estimate general linear combinations of your levels, such as

 

a*(recentkcaltert=0) + b*(recentkcaltert=1) + c*(recentkcaltert=2)

 

for any values of a, b or c that are allowable (estimable) based upon the data.

 

But you want a simpler comparison, where you are comparing one level to another level. This can be done easily via the LSMEANS command, where SAS has done the hard work to get the right comparisons, so you don't have to do that work in the ESTIMATE command. So in the case where the goal is to compare the means of one level to the means of another level, the ESTIMATE command is not the right tool (in the sense that it is more complicated to use and to get the right answer) whereas the LSMEANS command is the right tool, its much simpler to use.

--
Paige Miller
wmckvr
Calcite | Level 5

Thank you! I have never used LSMEANS before. This was easy and it worked.

For posterity, if anyone else has a similar question. Here's the code I ended up using.

proc mixed data=work.isopfinal2 method=reml covtest;
class Pt_number kcaltert (ref='0') recentkcaltert(ref='0')  ;
model logisopng_ml=  kcaltert recentkcaltert  kcaltert*recentkcaltert   /s ;
random intercept    /sub=pt_number Type=UN G;
lsmeans kcaltert*recentkcaltert /diff=all slice=kcaltert cl ;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 5 replies
  • 2861 views
  • 1 like
  • 2 in conversation