<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to use the macro after the imputation? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879263#M43487</link>
    <description>Thank you so much!</description>
    <pubDate>Mon, 05 Jun 2023 15:18:32 GMT</pubDate>
    <dc:creator>Lucai_sister</dc:creator>
    <dc:date>2023-06-05T15:18:32Z</dc:date>
    <item>
      <title>how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878236#M43437</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Hi, guys. I would like to study the mean difference in the number of relapse among the three treatment groups.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt; Because the data set was partially missing, after using multiple imputation, 100&amp;nbsp; imputation sets were obtained.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;After using pro genmod analysis, I want to use the nlmeans macro to compare the comparison results of each imputation set.&amp;nbsp; But the following result is prompted. Do you know why?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;here is my data&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;imputation&amp;nbsp; &amp;nbsp; &amp;nbsp; id&amp;nbsp; &amp;nbsp; &amp;nbsp; relapse_count&amp;nbsp; &amp;nbsp; lntime&amp;nbsp; &amp;nbsp;group&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;.....&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;here is my SAS code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;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)



&lt;/CODE&gt;&lt;/PRE&gt;Here is the error:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lucai_sister_0-1685453700392.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84484i30A3B60757812969/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lucai_sister_0-1685453700392.png" alt="Lucai_sister_0-1685453700392.png" /&gt;&lt;/span&gt;&lt;BR /&gt;here is my coeffs:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lucai_sister_1-1685453850889.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84485i422C2CA006A39D31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lucai_sister_1-1685453850889.png" alt="Lucai_sister_1-1685453850889.png" /&gt;&lt;/span&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Am I missing a procedure?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt; I really want researchers to help me.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 30 May 2023 13:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878236#M43437</guid>
      <dc:creator>Lucai_sister</dc:creator>
      <dc:date>2023-05-30T13:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878497#M43438</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how you should use multiple imputation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="co8aDb" role="heading" aria-level="3"&gt;&lt;STRONG&gt;Multiple imputation inference involves three distinct phases:&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="RqBzHd"&gt;
&lt;OL class="X5LH0c"&gt;
&lt;LI class="TrT0Xe"&gt;The missing data are filled in m times to generate m complete data sets or by-groups. (PROC MI)&lt;/LI&gt;
&lt;LI class="TrT0Xe"&gt;Perform regression or any other analysis on each of the m complete data sets or by-groups. (PROC GENMOD)&lt;/LI&gt;
&lt;LI class="TrT0Xe"&gt;Average the values of the parameter estimates across the M samples to produce a single point estimate. (PROC MIANALYZE)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;After 3. you can run the macro's you need!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also here:&lt;/P&gt;
&lt;P&gt;Multiple Imputation for Missing Data: Concepts and New Development (Version 9.0)&lt;BR /&gt;Yang C. Yuan, SAS Institute Inc., Rockville, MD&lt;BR /&gt;&lt;A href="https://support.sas.com/rnd/app/stat/papers/multipleimputation.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/rnd/app/stat/papers/multipleimputation.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/rnd/app/stat/topics/multiple-imputation.html" target="_blank" rel="noopener"&gt;https://support.sas.com/rnd/app/stat/topics/multiple-imputation.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;[EDIT] &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/443008"&gt;@Lucai_sister&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;My answer is not entirely correct, I believe. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;I am sure my colleagues &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155173"&gt;@SAS_Rob&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;know better, so please follow their advice.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;See below for their replies!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV id="ConnectiveDocSignExtentionInstalled" data-extension-version="1.0.4"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 31 May 2023 20:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878497#M43438</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-05-31T20:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878503#M43439</link>
      <description>&lt;P&gt;The %NLMEANS macro does not have a BY statement which is what you would need to make this work.&amp;nbsp; 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.&amp;nbsp; Once you do that you should be able to use Proc MIANALYZE to get the final combined estimates.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 17:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878503#M43439</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2023-05-31T17:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878570#M43441</link>
      <description>&lt;P&gt;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 &lt;A href="http://support.sas.com/kb/66249" target="_self"&gt;RunBY macro&lt;/A&gt;. This is discussed in the Details section of the NLMeans macro documentation and is&amp;nbsp;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.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro code;
  %nlmeans(instore=insmodel, coef=coeffs, link=log, where=&amp;amp;_BY1=&amp;amp;_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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 20:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/878570#M43441</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-05-31T20:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879262#M43486</link>
      <description>The code works fine. Thank you so much!</description>
      <pubDate>Mon, 05 Jun 2023 15:17:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879262#M43486</guid>
      <dc:creator>Lucai_sister</dc:creator>
      <dc:date>2023-06-05T15:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879263#M43487</link>
      <description>Thank you so much!</description>
      <pubDate>Mon, 05 Jun 2023 15:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879263#M43487</guid>
      <dc:creator>Lucai_sister</dc:creator>
      <dc:date>2023-06-05T15:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879264#M43488</link>
      <description>I really appreciate your advice!</description>
      <pubDate>Mon, 05 Jun 2023 15:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/879264#M43488</guid>
      <dc:creator>Lucai_sister</dc:creator>
      <dc:date>2023-06-05T15:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/941619#M47011</link>
      <description>&lt;P&gt;I run the code below and got error. Could you please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc logistic data = miout3;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;by _imputation_;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;class ILD MYCO TRT01P/PARAM=GLM ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; model response(event="1") = trt01p ILD MYCO;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; lsmeans TRT01P/e ilink diff;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; ods output coef=coeffs LSMeans = LSMeans Diffs=Diff;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; store out=ismodel;&lt;/DIV&gt;&lt;DIV&gt;run;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%macro code;&lt;/DIV&gt;&lt;DIV&gt;%nlmeans(instore=ismodel, coef=coeffs, link=LOGIT, where= &amp;amp;_BY1=&amp;amp;_LVL1,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;options=nonames noprint, title=rate diffs);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;data est; set est;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_imputation_=&amp;amp;_LVL1;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;proc append base=alldiff data=est;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;run;&lt;/DIV&gt;&lt;DIV&gt;%mend;&lt;/DIV&gt;&lt;DIV&gt;%runby(data=miout3, by=_imputation_)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;ERROR: The keyword parameter WHERE was not defined with the macro.&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Aug 2024 04:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/941619#M47011</guid>
      <dc:creator>lcdelta</dc:creator>
      <dc:date>2024-08-29T04:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/941750#M47018</link>
      <description>&lt;P&gt;Try downloading the latest version of the MACRO at link below.&amp;nbsp; The WHERE= option was added after the release of the autocall version in SAS 9.4m8.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/62/addl/fusion_62362_20_nlmeans.sas.txt" target="_blank"&gt;https://support.sas.com/kb/62/addl/fusion_62362_20_nlmeans.sas.txt&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 15:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/941750#M47018</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2024-08-29T15:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the macro after the imputation?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/941878#M47022</link>
      <description>&lt;A href="https://support.sas.com/kb/62/362.html" target="_blank"&gt;https://support.sas.com/kb/62/362.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Check it at bottom of URL.&lt;BR /&gt;%macro code;&lt;BR /&gt;       %nlmeans(instore=nb, coef=c, link=log, where=&amp;amp;_BY1=&amp;amp;_LVL1, &lt;BR /&gt;                options=nonames noprint, title=rate diffs)&lt;BR /&gt;       data est; set est; &lt;BR /&gt;         _imputation_=&amp;amp;_LVL1; &lt;BR /&gt;         run;&lt;BR /&gt;     proc append base=alldiff data=est;&lt;BR /&gt;         run;&lt;BR /&gt;     %mend;&lt;BR /&gt;     %runby(data=imput, by=_imputation_)</description>
      <pubDate>Fri, 30 Aug 2024 01:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/how-to-use-the-macro-after-the-imputation/m-p/941878#M47022</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-08-30T01:07:14Z</dc:date>
    </item>
  </channel>
</rss>

