<?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 How can I check interactions between categorical variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758644#M239581</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi, I would like to check interaction between 2 categorical variables. (outcome = drug prescription. I want to see is there any interaction variables with 'gender' variable)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I came up with following code;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt; &lt;STRONG&gt;logistic&lt;/STRONG&gt; data = hira.new_161718_outp_drugcode8;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;model drug_code2 (event = '1') = gender age institution region mcode year gender*age;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and I will do this for other variables (gender*institution, gender*region, gender*mcode, gener*year)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Does my approach correct?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or is there any way that I can see this at once?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does this code would allow me to do this?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt; &lt;STRONG&gt;logistic&lt;/STRONG&gt; data = hira.new_161718_outp_drugcode8;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;model drug_code2 (event = '1') = gender age institution region mcode year gender*age gender*institution gender*region gender*mcode gener*year);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And when I run the code, I get following result; (I attached result screen)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please check if my understanding is correct;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I interpret this data that there is weak interaction between gender and age, as estimate is -0.00001.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="capture.JPG" style="width: 530px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62177i67C0AD077D67B45E/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.JPG" alt="capture.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Aug 2021 12:58:19 GMT</pubDate>
    <dc:creator>waterjelly</dc:creator>
    <dc:date>2021-08-01T12:58:19Z</dc:date>
    <item>
      <title>How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758644#M239581</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, I would like to check interaction between 2 categorical variables. (outcome = drug prescription. I want to see is there any interaction variables with 'gender' variable)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I came up with following code;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt; &lt;STRONG&gt;logistic&lt;/STRONG&gt; data = hira.new_161718_outp_drugcode8;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;model drug_code2 (event = '1') = gender age institution region mcode year gender*age;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and I will do this for other variables (gender*institution, gender*region, gender*mcode, gener*year)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Does my approach correct?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or is there any way that I can see this at once?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does this code would allow me to do this?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN&gt; &lt;STRONG&gt;logistic&lt;/STRONG&gt; data = hira.new_161718_outp_drugcode8;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;model drug_code2 (event = '1') = gender age institution region mcode year gender*age gender*institution gender*region gender*mcode gener*year);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And when I run the code, I get following result; (I attached result screen)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please check if my understanding is correct;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I interpret this data that there is weak interaction between gender and age, as estimate is -0.00001.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="capture.JPG" style="width: 530px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62177i67C0AD077D67B45E/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.JPG" alt="capture.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 12:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758644#M239581</guid>
      <dc:creator>waterjelly</dc:creator>
      <dc:date>2021-08-01T12:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758645#M239582</link>
      <description>&lt;P&gt;Please include the screen capture of your output in your reply by clicking on the "Insert Photos" icon (and not as a file attachment).&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 21:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758645#M239582</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-01T21:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758656#M239591</link>
      <description>&lt;P&gt;dont they need a class statement for the categorical variables, and a strata statement would simplify the code if interactions beetn gender and all other variables is intended&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 15:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758656#M239591</guid>
      <dc:creator>pmbrown</dc:creator>
      <dc:date>2021-08-01T15:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758670#M239598</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/308996"&gt;@pmbrown&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;dont they need a class statement for the categorical variables, and a strata statement would simplify the code if interactions beetn gender and all other variables is intended&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Good point. As written, the code treats the age and gender as continuous variables. This may not matter for gender, which could be 0 or 1. But age is treated as continuous, not what it seems the original post meant to do.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 20:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758670#M239598</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-01T20:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758671#M239599</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/384616"&gt;@waterjelly&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Hi, I would like to check interaction between 2 categorical variables. (outcome = drug prescription. I want to see is there any interaction variables with 'gender' variable)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And when I run the code, I get following result; (I attached result screen)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please check if my understanding is correct;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I interpret this data that there is weak interaction between gender and age, as estimate is -0.00001.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="capture.JPG" style="width: 530px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62177i67C0AD077D67B45E/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.JPG" alt="capture.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In addition to the point made above, where you are not treating age and sex as a categorical variable (which seems to be what you said you were trying to do), the –0.0001 does not imply a weak interaction. It is a slope, which depends on the scale of the (numeric) sex*age interaction, which we don't really know; and the scale of the variable sex*age means you can't compare it to the other variables, so you can't really tell if –0.0001 is weak just from this output. I would recommend you create some graphical outputs (such as the Effect plot) from PROC LOGISTIC to help you see what is really happening; or if you treat sex and age as categorical variables you could look at the LSMEANS to determine the magnitude of the effects.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 21:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758671#M239599</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-01T21:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758696#M239609</link>
      <description>Thank you ur comment. I already coded them as 0 or 1 for gender and for age, I coded 0,1,2. so I think I don't need a class statement</description>
      <pubDate>Mon, 02 Aug 2021 04:32:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758696#M239609</guid>
      <dc:creator>waterjelly</dc:creator>
      <dc:date>2021-08-02T04:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758709#M239613</link>
      <description>&lt;P&gt;actually, you would still need a class statement for age. The only way to avoid a class statement would be to derive multiple indicator vars, ie if c categories then c-1 indicator variables. In any case, any statistician would say not to categorise continuous age, perhaps the data were collected that way though and youre stuck with it&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 06:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758709#M239613</guid>
      <dc:creator>pmbrown</dc:creator>
      <dc:date>2021-08-02T06:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758737#M239636</link>
      <description>&lt;P&gt;Coding age as 0 1 2 still makes it continuous, not class. The only way to use class variables is to put them in a CLASS statement.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 10:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758737#M239636</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-02T10:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758740#M239639</link>
      <description>&lt;P&gt;no, it makes it categorical, they have said they categorised age, only a class statement makes sense here, the categorical variable shouldnt be treated as continuous even if it's ordinal, it's a coding error for sure, but they can do whatever they want, age should never be categorised, that analysis would not pass review unless the information loss is inherent in the data&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 10:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758740#M239639</guid>
      <dc:creator>pmbrown</dc:creator>
      <dc:date>2021-08-02T10:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I check interactions between categorical variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758743#M239641</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/308996"&gt;@pmbrown&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;no, it makes it categorical, they have said they categorised age, only a class statement makes sense here, the categorical variable shouldnt be treated as continuous even if it's ordinal, it's a coding error for sure, but they can do whatever they want, age should never be categorised, that analysis would not pass review unless the information loss is inherent in the data&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;yes, I agree&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 10:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-check-interactions-between-categorical-variables/m-p/758743#M239641</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-02T10:50:40Z</dc:date>
    </item>
  </channel>
</rss>

