BookmarkSubscribeRSS Feed
Lucai_sister
Obsidian | Level 7

Hello, guys. I just learned SAS, and I have been puzzled for many days. I hope you can help me.

My data is the number of relapses(Y) in different treatment groups (group=1,2,3) , and I want to compare the difference in the number of relapses in different treatment groups under the least squares mean estimation. I used the lsmeans statement to compare the differences. It outputs the difference of the estimated coefficient(Beta1-Beta3, Beta2-Beta3). But I want to get the differences of Y.

my data is like:

id   group   relapse_count   lntime 

1         1             0                          -1.108

2        2             1                           -0.693

3        3             1                           -3.218

4        2             2                          -1.108

.........

 

here is my SAS codes:

proc genmod data=a;
class group(ref="3") id/param=glm;
model relapse_count=group/link=log dist=negbin offset=lntime;
repeated subject=id;
lsmeans group/cl ilink exp ;
estimate '2-1' group -1 1 0/exp;
estimate '1-3' group 1 0 -1/exp;
estimate '2-3' group 0 1 -1/exp;

run;

 

 

I would appreciate it if you could help me!

 

 

 

 

4 REPLIES 4
Lucai_sister
Obsidian | Level 7
Thank you for your reply, which makes it more clear that what I want to ask for is the rate rather than the count difference. But I don't know why the NLMeans macro is used. In my opinion it is just more convenient to call. Does it help to find the difference in rates? Thank you very much for your guidance.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1095 views
  • 0 likes
  • 2 in conversation