BookmarkSubscribeRSS Feed
Nouf2
Calcite | Level 5

Hello, 

I have a table of five age groups each has  Person-years for smokers and nonsmokers, and Coronary Deaths for smokers and nonsmokers. I need to figure out the codes for Poisson regression to the two below problems: 

 

1. Fit a Poisson regression with count of coronary deaths as response variable, find the risk ratio (smoker vs. nonsmoker) adjusted for age. 

 

2. Fit a Poisson regression with person-years rate of coronary deaths as response variable, find the risk ratio (smoker vs. nonsmoker) adjusted for age. 

 

For problem 1 I have tried the following code. However, I think it is wrong since i need to count the deaths not person_years !! (nonsmokers=0) (smokers=1)

data CORONARY_DEATHS;
input age smoke count p_time; 
log_time=log(p_time); 
datalines; 
35 0 2 18793 
35 1 32 52407
45 0 12 10673
45 1 104 43248 
55 0 28 5710 
55 1 206 12663 
65 0 28 2585
65 1 186 12663
75 0 31 1462
75 1 102 5317
;
run;

data CORONARY_DEATHS;
input age smoke count p_time; 
log_time=log(p_time); 
datalines; 
35 0 2 18793 
35 1 32 52407
45 0 12 10673
45 1 104 43248 
55 0 28 5710 
55 1 206 12663 
65 0 28 2585
65 1 186 12663
75 0 31 1462
75 1 102 5317
;
run;

data CORONARY_DEATHS; set CORONARY_DEATHS; 
AGE55=0; if AGE=55 then AGE55=1; 
AGE65=0; if AGE=65 then AGE65=1;
 run;
proc genmod data=CORONARY_DEATHS; 
model count=smoke AGE55 AGE65/dist=poi link=log offset=log_time; run;

 

 

PS: I am a healthcare student taking biostatistics and SAS is part of the course. Therefore, little knowledge is what I have. 

 

Thank you 

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Hello,

 

You said: I think it is wrong since I need to count the deaths not person_years !!

I do not understand why you think you have the wrong response (variable). You have specified the correct target variable in your model statement. And you are quite well aligning with this example (maybe you used it as a basis for your code?):

SAS/STAT® 15.2 User's Guide -- The GENMOD Procedure -- Poisson Regression

https://go.documentation.sas.com/?docsetId=statug&docsetTarget=statug_genmod_gettingstarted01.htm&do...

 

Note there exist many SAS papers on Poisson regression (with SAS) and you can also use the COUNTREG procedure (count regression SAS/ETS) to fit a Poisson regression.

 

Cheers,

Koen

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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