<?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 do I use the margins macro to calculate risk differences for an interaction term? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776342#M38025</link>
    <description>&lt;P&gt;Getting margins for an interaction means getting margins for each of the combinations of levels of the interacting variables. You can do that by simply specifying the interaction in &lt;STRONG&gt;margins=&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Margins(data = wicmarg,
         class = rural time,
         response = ovob,
         roptions = event='1' ,
         model = rural time rural*time,
         dist = binomial,
         margins = rural*time,
         options = atmeans cl diff reverse)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 26 Oct 2021 01:05:53 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2021-10-26T01:05:53Z</dc:date>
    <item>
      <title>How do I use the margins macro to calculate risk differences for an interaction term?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776275#M38023</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the margins macro in SAS 9.4 to calculate risk differences. My model is looking at changes in pre-pregnancy overweight and obesity (ovob) over time (time) as a function of rurality status (rural). The outcome of pre-pregnancy overweight and obesity (ovob) is dichotomous, rurality status (rural) is also dichotomous, and the time variable has 4 levels. I am currently able to get risk differences for the main effects of rurality status and time by listing them separately in the "margins" statement. However, I'm not sure how to get risk differences for the interaction time (rural*time). Any guidance would be much appreciated! I've copied my code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Margins(data = wicmarg,&lt;/P&gt;&lt;P&gt;class = rural time,&lt;/P&gt;&lt;P&gt;response = ovob,&lt;/P&gt;&lt;P&gt;roptions = event='1' ,&lt;/P&gt;&lt;P&gt;model = rural time rural*time,&lt;/P&gt;&lt;P&gt;dist = binomial,&lt;/P&gt;&lt;P&gt;margins = rural,&lt;/P&gt;&lt;P&gt;options = atmeans cl diff reverse);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776275#M38023</guid>
      <dc:creator>emery049</dc:creator>
      <dc:date>2021-10-25T19:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the margins macro to calculate risk differences for an interaction term?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776342#M38025</link>
      <description>&lt;P&gt;Getting margins for an interaction means getting margins for each of the combinations of levels of the interacting variables. You can do that by simply specifying the interaction in &lt;STRONG&gt;margins=&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Margins(data = wicmarg,
         class = rural time,
         response = ovob,
         roptions = event='1' ,
         model = rural time rural*time,
         dist = binomial,
         margins = rural*time,
         options = atmeans cl diff reverse)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Oct 2021 01:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776342#M38025</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-10-26T01:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the margins macro to calculate risk differences for an interaction term?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776523#M38033</link>
      <description>&lt;P&gt;Thanks for your response, Dave! I should have mentioned that I had already tried entering the interaction term in the "margins=" statement. When I do that, I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: &amp;amp;margins ne&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I don't believe the "*" is allowed in this statement. Any other thoughts on how to get around this would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 15:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776523#M38033</guid>
      <dc:creator>emery049</dc:creator>
      <dc:date>2021-10-26T15:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the margins macro to calculate risk differences for an interaction term?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776525#M38034</link>
      <description>&lt;P&gt;That code works fine for me using the current release of the Margins macro - v1.08.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 15:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776525#M38034</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-10-26T15:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the margins macro to calculate risk differences for an interaction term?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776529#M38035</link>
      <description>&lt;P&gt;Turns out I was using an older version of the macro&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_without_mouth:"&gt;😶&lt;/span&gt; Now that I use v1.08, it seems to be running just fine. Thanks again for your help with this!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 15:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-use-the-margins-macro-to-calculate-risk-differences-for/m-p/776529#M38035</guid>
      <dc:creator>emery049</dc:creator>
      <dc:date>2021-10-26T15:36:09Z</dc:date>
    </item>
  </channel>
</rss>

