Hello! I'm trying to get the incidence rates adjusting for multiple covariates and stratified by sex and age.
This is what my data looks like:
case person-time age sex smoke alcohol urban
0 2 18 1 0 1 0
1 7 19 2 1 0 1
1 4 20 1 0 1 1
To get the unadjusted, I was interested in incidence of cases/total person-time by age and sex, and I was able to do a proc sql to get the numerator and denominator file and got distinct cases/total person time.
*numerator file*; proc sql ; Create table numerator as select distinct sum(cases) as cases, sex, age from filename where cases=1 group by age, sex; quit; *to create my denominator* proc sql ; Create table denominator as select distinct sum(persontime) as pt, sex, age from filename group by age, sex; quit;
I then modeled it using a Poisson distribution to get the Incidence rates confidence intervals.
proc genmod data=g.filename;
class age sex;
model cases=age sex / offset=logpyr dist=nb link=log type3;
lsmeans age sex/ilink cl diff means;
store out=insmodel;
run;
*proc plm*;
proc plm source=insmodel;
score data=filename out=inspred pred stderr lclm uclm/nooffset ilink;
run;
proc print label;
id cases total;
run;
However, when I try do the adjusted model, where I adjust for smoke, alcohol, sex and age, I get multiple rates for all the possible combinations of the variables I'm trying to adjust for. I've tried using this sas note but it's note giving me the ouput I want.
Moved to STAT forum and re-titled.
I assume you want the marginal rates for sex, age, alcohol and smokes. Try this:
proc genmod data=g.filename;
class age sex alcohol smokes;
model cases=age sex alcohol smokes / offset=logpyr dist=nb link=log type3;
lsmeans age sex alcohol smokes/ilink cl diff means;
run;
As in the first example in the note your referenced, this will give you the rates for each level of age, averaged over sex, alcohol and smokes; the rates for each level of sex, averaged over age, alcohol and smokes; the rates for each level of alcohol, averaged over age, sex and smokes; and the rates for each level of smokes, average over age, sex and alcohol.
If you want more specific comparisons, then you will need to include interactions in the model and look at the lsmeans for the interacting variables. This is where the STORE and PROC PLM method can become more useful.
If you have a lot of levels for age, you may want to make it a continuous effect.
SteveDenham
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.