Calcite | Level 5

Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod

Hi,

I am new to programming in SAS. I have count data for prescriptions in each year of the study. Each row has the number of prescirpitons in that uear, the person-time, the rate and the ln(person time). I want to use proc genmod to calculate the rate ratio:

1) Between each year of the study compared to the first year of the study (1998) as a reference

2) Between each year of the study and the previous year (i.e. 1999 to 1998, 2000 to 1999 etc)

I am having trouble to set my estimate statement in the code so I will get the rate ration for each year.

This is my data structure:

 Yearrx RX PT rate lnPT 1998 100 135 0.740741 4.905275 1999 200 480 0.416667 6.173786 2000 250 950 0.263158 6.856462 2001 300 1100 0.272727 7.003065 2002 350 2100 0.166667 7.649693 2003 450 2500 0.18 7.824046

Hoe should my code look like?

proc genmod data=h2only  ;
Class Yearrx (ref="1998");
model rx=Yearrx /dist=negbin  scale=deviance offset=ln;
estimate '1998' Yearrx 1 -1;
estimate '1999' Yearrx 1 -1;
estimate '2000' Yearrx 1 -2;
run;y

3 REPLIES 3
Calcite | Level 5

Re: Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod

Is this code more correct?

proc genmod data=h2only ;
Class Yearrx (ref="1998");
model rx=Yearrx /dist=negbin scale=deviance offset=ln;
estimate '1999 vs. 1998' Yearrx 1 -1;
estimate '2000 vs. 1998' Yearrx 2 -2;
estimate '2001 vs. 1998' Yearrx 3 -3;
run;
Diamond | Level 26

Re: Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod

Don't use ESTIMATE statement to compare levels. Use the LSMEANS command.

lsmeans yearrx / cl lines linestable;

You may not want all of those options, but that is where I would start.

--
Paige Miller
Calcite | Level 5

Re: Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod

Thank you! The lsmeans gives a table of Analysis Of Maximum Likelihood Parameter Estimates, where I get the rate ratio for each year compared to 1998- that is what I am looking for...however is there a way to get the estimates (rate ratios) not in logarithmic number but the exponential? I can do it for the rates but not for the parameter estimates. Thank you!
Discussion stats
• 3 replies
• 275 views
• 0 likes
• 2 in conversation