Hi, guys. I would like to study the mean difference in the number of relapse among the three treatment groups. Because the data set was partially missing, after using multiple imputation, 100 imputation sets were obtained.
After using pro genmod analysis, I want to use the nlmeans macro to compare the comparison results of each imputation set. But the following result is prompted. Do you know why?
here is my data
imputation id relapse_count lntime group
1 1 0 -1 1
1 2 2 -3 2
.....
100 33 3 -4 3
here is my SAS code:
Here is the error:stype1: proc genmod data=relapse; class group(ref="1") id/param=glm; model relapse_count=group/link=log dist=negbin offset=lntime; repeated subject=id; lsmeans group/ilink cl e; estimate 'group2 vs 1 of RR' group -1 1 0/e; estimate 'group1 vs 3 of RR' group 1 0 -1/e; estimate 'group2 vs 3 of RR' group 0 1 -1/e; ods output coef=coeffs; store out=insmodel; by _Imputation_; run; stype2: %include 'path\nlest.sas'; %include 'path\nlmeans.sas'; %NLMeans(instore=insmodel, coef=coeffs, link=log, title=Difference of relapse Rates)
here is my coeffs:Am I missing a procedure? I really want researchers to help me.
As Rob suggests, to get a final combined rate estimate you need to run NLMeans on each imputation data set and then combine the results. BY processing can be done by using the NLMeans macro in the RunBY macro. This is discussed in the Details section of the NLMeans macro documentation and is illustrated in the last example in the Results tab. In your case, you should drop the ESTIMATE statements since only the LSMEANS statement is needed. Then, after downloading the RunBY macro and defining it in your session using a %INC statement, you should just need to add the following after your GENMOD step. I also suggest you make sure you are using the latest versions of the NLMeans and NLEST macro (which NLMeans calls). You can download the latest versions from support.sas.com.
%macro code;
%nlmeans(instore=insmodel, coef=coeffs, link=log, where=&_BY1=&_LVL1,
options=nonames noprint, title=rate diffs)
proc append base=alldiff data=est; run;
%mend;
%runby(data=relapse, by=_imputation_)
data alldiff;
set alldiff;
_imputation_=_n_;
run;
proc mianalyze data=alldiff;
modeleffects estimate;
stderr standarderror;
run;
Hello,
Here's how you should use multiple imputation.
After 3. you can run the macro's you need!
See also here:
Multiple Imputation for Missing Data: Concepts and New Development (Version 9.0)
Yang C. Yuan, SAS Institute Inc., Rockville, MD
https://support.sas.com/rnd/app/stat/papers/multipleimputation.pdf
https://support.sas.com/rnd/app/stat/topics/multiple-imputation.html
[EDIT] @Lucai_sister
My answer is not entirely correct, I believe.
I am sure my colleagues @SAS_Rob and @StatDave know better, so please follow their advice.
See below for their replies!
Koen
The %NLMEANS macro does not have a BY statement which is what you would need to make this work. My suggestion would be to run the macro for each _imputation_ independently and then combine the estimates and standard errors into a single data set. Once you do that you should be able to use Proc MIANALYZE to get the final combined estimates.
As Rob suggests, to get a final combined rate estimate you need to run NLMeans on each imputation data set and then combine the results. BY processing can be done by using the NLMeans macro in the RunBY macro. This is discussed in the Details section of the NLMeans macro documentation and is illustrated in the last example in the Results tab. In your case, you should drop the ESTIMATE statements since only the LSMEANS statement is needed. Then, after downloading the RunBY macro and defining it in your session using a %INC statement, you should just need to add the following after your GENMOD step. I also suggest you make sure you are using the latest versions of the NLMeans and NLEST macro (which NLMeans calls). You can download the latest versions from support.sas.com.
%macro code;
%nlmeans(instore=insmodel, coef=coeffs, link=log, where=&_BY1=&_LVL1,
options=nonames noprint, title=rate diffs)
proc append base=alldiff data=est; run;
%mend;
%runby(data=relapse, by=_imputation_)
data alldiff;
set alldiff;
_imputation_=_n_;
run;
proc mianalyze data=alldiff;
modeleffects estimate;
stderr standarderror;
run;
I run the code below and got error. Could you please help?
Try downloading the latest version of the MACRO at link below. The WHERE= option was added after the release of the autocall version in SAS 9.4m8.
https://support.sas.com/kb/62/addl/fusion_62362_20_nlmeans.sas.txt
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.