<?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 Interaction code in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862521#M42640</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question on how to code an interaction for my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My aim is to know the interaction of diet (continuous variable) and physical activity (categorical variable, three levels: low, mod, high) on T2DM and inflammatory markers. I want to set physical activity "low" as reference so that I can see the comparison of "mod" to "low", and "high" to "low".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the logistic regression model on T2DM, should I set physical activity as dummy variables and write the code as:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data mydata;
set mydata;
if IPAQ= 1 then low = 1;
else low=0;
if IPAQ= 2 then mod = 1;
else mod=0;
if IPAQ = 3 then high = 1;
else high=0;
run;&lt;/PRE&gt;&lt;PRE&gt;proc logistic data = mydata;
class mod high/ ref=first;
model T2DM (event = '1') = diet mod high diet*mod diet*high confounders/ cl;
run;&lt;/PRE&gt;&lt;P&gt;Or should I write the logistic regression model separately, like, for mod:&lt;/P&gt;&lt;PRE&gt;proc logistic data = mydata;
class mod / ref=first;
model T2DM (event = '1') = diet mod diet*mod confounders/ cl;
run;&lt;/PRE&gt;&lt;P&gt;and for high:&lt;/P&gt;&lt;PRE&gt;proc logistic data = mydata;
class high/ ref=first;
model T2DM (event = '1') = diet high diet*high confounders/ cl;
run;&lt;/PRE&gt;&lt;P&gt;I'm not sure which statistical method is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 16:34:05 GMT</pubDate>
    <dc:creator>greenie</dc:creator>
    <dc:date>2023-03-06T16:34:05Z</dc:date>
    <item>
      <title>Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862521#M42640</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question on how to code an interaction for my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My aim is to know the interaction of diet (continuous variable) and physical activity (categorical variable, three levels: low, mod, high) on T2DM and inflammatory markers. I want to set physical activity "low" as reference so that I can see the comparison of "mod" to "low", and "high" to "low".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the logistic regression model on T2DM, should I set physical activity as dummy variables and write the code as:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data mydata;
set mydata;
if IPAQ= 1 then low = 1;
else low=0;
if IPAQ= 2 then mod = 1;
else mod=0;
if IPAQ = 3 then high = 1;
else high=0;
run;&lt;/PRE&gt;&lt;PRE&gt;proc logistic data = mydata;
class mod high/ ref=first;
model T2DM (event = '1') = diet mod high diet*mod diet*high confounders/ cl;
run;&lt;/PRE&gt;&lt;P&gt;Or should I write the logistic regression model separately, like, for mod:&lt;/P&gt;&lt;PRE&gt;proc logistic data = mydata;
class mod / ref=first;
model T2DM (event = '1') = diet mod diet*mod confounders/ cl;
run;&lt;/PRE&gt;&lt;P&gt;and for high:&lt;/P&gt;&lt;PRE&gt;proc logistic data = mydata;
class high/ ref=first;
model T2DM (event = '1') = diet high diet*high confounders/ cl;
run;&lt;/PRE&gt;&lt;P&gt;I'm not sure which statistical method is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 16:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862521#M42640</guid>
      <dc:creator>greenie</dc:creator>
      <dc:date>2023-03-06T16:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862524#M42641</link>
      <description>&lt;P&gt;You should use your original, three-level variable in the CLASS statement. The CLASS statement is there to create dummy variables for you, so there is no need to create them yourself. Use PARAM=REF (or GLM) to use the typical 0,1 coding.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data = mydata;
class IPAQ / ref=first param=ref;
model T2DM (event = '1') = diet IPAQ diet*IPAQ confounders/ cl;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 16:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862524#M42641</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-03-06T16:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862532#M42642</link>
      <description>&lt;P&gt;Thank you! So when for the glm statement for inflammatory markers as outcome, this code with class statement seemed not work...Do you have any suggestion on dealing this?&lt;/P&gt;&lt;PRE&gt;proc glm data = mydata;
class IPAQ / ref=first param=ref;
model IL8 = diet IPAQ diet*IPAQ confounders/ cl;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2023 17:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862532#M42642</guid>
      <dc:creator>greenie</dc:creator>
      <dc:date>2023-03-06T17:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862537#M42643</link>
      <description>&lt;P&gt;Don't say something didn't work, and then give us no further information about what didn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Give us information about what didn't work.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If there are errors in the log, show us the ENTIRE log for this PROC or DATA step&lt;/LI&gt;
&lt;LI&gt;If the output is incorrect, show us the incorrect output and EXPLAIN why you think it is incorrect.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 06 Mar 2023 17:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862537#M42643</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-06T17:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862538#M42644</link>
      <description>PROC GLM does not support the PARAM= option in the CLASS statement. See the PROC GLM documentation anytime you get syntax errors. By default, the CLASS statement in PROC GLM will use 0,1 coding, so you do not need that option anyway. You will also need to remove the CL option from the MODEL statement.</description>
      <pubDate>Mon, 06 Mar 2023 17:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862538#M42644</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-03-06T17:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862539#M42645</link>
      <description>&lt;PRE&gt;99   proc glm data = mydata;
100  class IPAQ/ ref=first param=ref;
                                    -----
                                    22
                                    202
NOTE: The previous statement has been deleted.
ERROR 22-322: Syntax error, expecting one of the following: ;, REF, REFERENCE, TRUNCATE.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
101  model IL8 =diet IPAQ diet*IPAQ age BMI/ cl;
                            --
                            22
                            202
NOTE: The previous statement has been deleted.
ERROR 22-322: Syntax error, expecting one of the following: ;, ALIASING, ALPHA, CLI, CLM,
              CLPARM, COVBYCLASS, E, E1, E2, E3, E4, EST, I, INTERCEPT, INVERSE, NOINT, NOUNI,
              P, PREDICTED, SINGULAR, SOLUTION, SS1, SS2, SS3, SS4, TOLERANCE, X, XPX, ZETA.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
102 run;

&lt;/PRE&gt;&lt;P&gt;Please see this&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 17:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862539#M42645</guid>
      <dc:creator>greenie</dc:creator>
      <dc:date>2023-03-06T17:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Interaction code</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862549#M42646</link>
      <description>&lt;P&gt;I got it. Thank you SO MUCH!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 18:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Interaction-code/m-p/862549#M42646</guid>
      <dc:creator>greenie</dc:creator>
      <dc:date>2023-03-06T18:00:46Z</dc:date>
    </item>
  </channel>
</rss>

