BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Lucai_sister
Obsidian | Level 7

Hello, everyone. 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, 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:

obs

 

 

 

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;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

Since you use an offset, your model is actually on a rate rather than a count. If what you want is to estimate and test the difference in rates, then you can use the NLMeans macro as shown in this note. If you really want to compare the counts only (the numerators of the rates), then that will depend on the value of the offset. You could do that using the NLEST/NLEstimate macro (also shown in the above note), but you would need to include, in each EXP() expression, the desired offset variable value at which you want to compute the difference.

View solution in original post

4 REPLIES 4
StatDave
SAS Super FREQ

Since you use an offset, your model is actually on a rate rather than a count. If what you want is to estimate and test the difference in rates, then you can use the NLMeans macro as shown in this note. If you really want to compare the counts only (the numerators of the rates), then that will depend on the value of the offset. You could do that using the NLEST/NLEstimate macro (also shown in the above note), but you would need to include, in each EXP() expression, the desired offset variable value at which you want to compute the difference.

Lucai_sister
Obsidian | Level 7

Thank you@StaDave.

The link contains the answer I want. But when I run the NLmeans code, I get a WARNING: No call to parse macro "NLMEANS".

Being a beginner, I don't quite know the solution to this problem. Can you help me?

 

Lucai_sister
Obsidian | Level 7
I'm sorry I typed your name wrong.
Thank@StatDave.
StatDave
SAS Super FREQ

As noted in red at the top of the documentation for the NLMeans and NLEST macros, these macros should be directly callable in SAS 9.4M6 or later. But if, for some reason, either of these is not found, then they can be downloaded and defined in your SAS session as discussed at the links provided above. Note that the NLMeans macro calls the NLEST macro so both are needed. You can check their availability in your SAS session and check their versions using the following calls. I suggest using the latest versions which, as noted in their documentation, are 1.9 for NLEST and 1.4 for NLMeans. 

%nlest(v)
%nlmeans(v)

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 497 views
  • 4 likes
  • 2 in conversation