Hello,
This is my first time writing here. I have mortality data from a cohort study. I've been trying to calculate incidence rates for mortality with no success. I used proc genmod with lsmeans to estimate the IR using Poisson, but the results are very very different from those obtained by my colleague using STATA.This is the code I've been using:
proc genmod data=muj;
class muerto diabetes(ref=first) educacion(ref=first) sexo(ref=last);
model muerto=edad educacion diabetes/dist=poisson
link=log
offset=logpyears;
lsmeans diabetes/ilink exp cl diff OM;
run;
The stata code used for this is the following:
poisson muerto i.diabetes i.cat_edad i.educacion, exposure(pyears) irr
margins diabetes, predict(ir)
Is there some procedure or code that gives me adjusted incidence rates?
Thanks to all in advance
You would need to fit exactly the same model in both SAS and Stata since any difference in the fitted model can cause a difference, large or small, in estimated values. A predictive margin for a level of your predictor is the average predicted value when all observations in your data have the predictor set to that level. So, you could easily compute the point estimate of the margin by creating a copy of your data set with your predictor set to one level and then compute all the predicted values and average them.
I moved this to the SAS/STAT community, so that the experts for that may be notified of your question.
Thanks 😄
The SAS code looks correct and follows what is discussed in this note. But your Stata code looks like the model only has one predictor while your SAS code has three, so that will clearly cause a difference. Additionally, note that the predictive margin computed in Stata is not the same as an LS-mean.
You would need to fit exactly the same model in both SAS and Stata since any difference in the fitted model can cause a difference, large or small, in estimated values. A predictive margin for a level of your predictor is the average predicted value when all observations in your data have the predictor set to that level. So, you could easily compute the point estimate of the margin by creating a copy of your data set with your predictor set to one level and then compute all the predicted values and average them.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.