BookmarkSubscribeRSS Feed
reemm225
Calcite | Level 5

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: 

YearrxRXPTratelnPT
19981001350.7407414.905275
19992004800.4166676.173786
20002509500.2631586.856462
200130011000.2727277.003065
200235021000.1666677.649693
200345025000.187.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
reemm225
Calcite | Level 5
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;
PaigeMiller
Diamond | Level 26

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
reemm225
Calcite | Level 5
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!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 280 views
  • 0 likes
  • 2 in conversation