BookmarkSubscribeRSS Feed
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;




I would appreciate it if you could help me!





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.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2 in conversation