<?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 include 2 categorial variables in a Two sample t test in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557912#M74800</link>
    <description>&lt;P&gt;I think what you are asking is:&lt;/P&gt;&lt;P&gt;1) how to get the treatment effect for females&lt;/P&gt;&lt;P&gt;2) how to get the treatment effect for males&lt;/P&gt;&lt;P&gt;3) how to get the difference between the treatment effect for females and treatment effect for males&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, I'd do this:&lt;/P&gt;&lt;P&gt;proc glm data=...;&lt;BR /&gt;class group;&lt;BR /&gt;model outcome=group / noint;&lt;BR /&gt;contrast 'Difference of Differences' group 1 -1 -1 1; /*if this is significant then the difference between treatment and control are different between males and females*/&lt;BR /&gt;contrast 'Male Effect' group 1 -1 0 0; /* if this is significant then the difference between treatment and control for males is significant */&lt;BR /&gt;contrast 'Female Effect' group 0 0 1 -1; /* if this is significant then the difference between treatment and control for females is significant */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;group =1 if sex=male and treatment=control&lt;/P&gt;&lt;P&gt;group =2 if sex=male and treatment=treatment&lt;/P&gt;&lt;P&gt;group =3 if sex=female and treatment=control&lt;/P&gt;&lt;P&gt;group =4 if sex=female and treatment=treatment&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2019 18:23:03 GMT</pubDate>
    <dc:creator>DWilson</dc:creator>
    <dc:date>2019-05-10T18:23:03Z</dc:date>
    <item>
      <title>How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557060#M74769</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a small randomised study with 10 patients in the intervention and 8 patients in the control group. I have one before and one after measurement on each patient.&lt;/P&gt;&lt;P&gt;I want to find out the mean differences between the groups on my outcomes and have created a new dataset with the differences and logged one of the variables (HbA1c) to get a more normal distribution of data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; work.log;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; WORK.TTEST_0000;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;class=treat;&lt;/P&gt;&lt;P&gt;lpreHbA1c=log2(preHbA1c);&lt;/P&gt;&lt;P&gt;lPostHbA1c=log2 (postHbA1c);&lt;/P&gt;&lt;P&gt;DDdif=preDD-PostDD;&lt;/P&gt;&lt;P&gt;HADSdif=preHADS-PostHADS;&lt;/P&gt;&lt;P&gt;HbA1cdif=lprehbA1c-lpostHba1c;&lt;/P&gt;&lt;P&gt;W5dif=pre_W5-Post_W5;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have run the t test:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;ttest&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=WORK.log;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Treat;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; DDdif HADSdif HbA1cdif W5dif;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;But need to know the differences between genders in the two samples, but get an error when I inpute gender (called "Kon")&amp;nbsp;in the class statement.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;How should I input gender (Kon)&amp;nbsp;to&amp;nbsp;make&amp;nbsp;the subgroup analysis ?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;NB. I use SAS enterprise.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks in advance.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;BW, &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Sophie&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 10:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557060#M74769</guid>
      <dc:creator>AnneSophie</dc:creator>
      <dc:date>2019-05-08T10:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557074#M74770</link>
      <description>&lt;P&gt;PROC TTEST allows only one variable in the CLASS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems like you have a situation where the proper analysis is a paired analysis to compare before versus after, which you can achieve by computing differences before versus after, as you have done; or it can be done on the un-differenced data using the PAIRED statement. However, if you want to introduce gender into the analysis, this requires PROC GLM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=work.log;
    class gender treat;
    model dddif hadsdif hba1cdif w5dif = gender treat;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although this is not called a t-test, it is the logical and statistical equivalent of a t-test in the situation you described.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 12:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557074#M74770</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-08T12:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557086#M74771</link>
      <description>&lt;P&gt;Dear Paige Miller.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your quick reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The GLM statement works, however, the difference for the two genders;&amp;nbsp;men respectively women, seems to be missing in the output?&lt;/P&gt;&lt;P&gt;Or I might not interpret correctly..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Source DF Type I SS Mean Square F Value Pr&amp;nbsp;&amp;gt;&amp;nbsp;F &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Kon&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;126.0250000&lt;/TD&gt;&lt;TD&gt;126.0250000&lt;/TD&gt;&lt;TD&gt;0.80&lt;/TD&gt;&lt;TD&gt;0.3852&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Treat&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;387.6568182&lt;/TD&gt;&lt;TD&gt;387.6568182&lt;/TD&gt;&lt;TD&gt;2.46&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;0.1376&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Source DF Type III SS Mean Square F Value Pr&amp;nbsp;&amp;gt;&amp;nbsp;F &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Kon&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;84.6568182&lt;/TD&gt;&lt;TD&gt;84.6568182&lt;/TD&gt;&lt;TD&gt;0.54&lt;/TD&gt;&lt;TD&gt;0.4748&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Treat&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;387.6568182&lt;/TD&gt;&lt;TD&gt;387.6568182&lt;/TD&gt;&lt;TD&gt;2.46&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;0.1376&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV align="center"&gt;&lt;DIV align="center"&gt;I also get a Interaction plot for DDdif&lt;/DIV&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV align="center"&gt;&lt;DIV align="center"&gt;&lt;DIV align="center"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Interactionplot_DDdif.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29302i8319FBA3361B744E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Interactionplot_DDdif.JPG" alt="Interactionplot_DDdif.JPG" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 08 May 2019 12:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557086#M74771</guid>
      <dc:creator>AnneSophie</dc:creator>
      <dc:date>2019-05-08T12:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557088#M74772</link>
      <description>&lt;P&gt;In PROC GLM, add the LSMEANS statement, with whatever options you want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;lsmeans gender treat/tdiff;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2019 12:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557088#M74772</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-08T12:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557838#M74791</link>
      <description>&lt;P&gt;It's not clear what you mean by differences in genders. If you are talking about analyzing males and females separately, just subset your data to males and run your proc ttest for them and then do another proc ttest for females.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are talking about a difference in differences sort of test: (mean for males - mean for females in control group) - (mean for males - mean for females in treatment group) then you need to set up something like proc glm (as recommended by another person) and use a contrast statment to construct that difference and get a t-test around it.&lt;/P&gt;&lt;P&gt;Let group takes on values 1 to 4;&lt;/P&gt;&lt;P&gt;group =1 if sex=male and treatment=control&lt;/P&gt;&lt;P&gt;group =2 if sex=male and treatment=treatment&lt;/P&gt;&lt;P&gt;group =3 if sex=female and treatment=control&lt;/P&gt;&lt;P&gt;group =4 if sex=female and treatment=treatment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like (key parts shown);&lt;/P&gt;&lt;P&gt;proc glm data=...;&lt;/P&gt;&lt;P&gt;class group;&lt;/P&gt;&lt;P&gt;model outcome=group / noint;&lt;/P&gt;&lt;P&gt;contrast 'Difference of Differences' group 1 -1 -1 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 15:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557838#M74791</guid>
      <dc:creator>DWilson</dc:creator>
      <dc:date>2019-05-10T15:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557864#M74795</link>
      <description>&lt;P&gt;The proc glm code you have doesn't account for an interaction term. It won't capture the interaction between sex and outcome.&lt;/P&gt;&lt;P&gt;You could do: model outcome=sex treatment sex*treatment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but getting the test you want from that model is somewhat complicated.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 16:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557864#M74795</guid>
      <dc:creator>DWilson</dc:creator>
      <dc:date>2019-05-10T16:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557904#M74798</link>
      <description>&lt;P&gt;Dear DWilson.&lt;/P&gt;&lt;P&gt;Thanks for your comprehensive reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By differences in gender I mean;&lt;/P&gt;&lt;P&gt;If the effect of the intervention differs between men and women on all outcomes.&lt;/P&gt;&lt;P&gt;I need a mean + CL + p-value in the output for men&amp;nbsp;AND women separately. (As the intervention had previously been reported to have a better effect in women) (Kon = gender)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would this code give me that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;glm&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=work.log_new;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; treat Kon;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Model&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; PostDD = treat kon PreDD/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;solution&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;clparm&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;However, I'm not sure how to interpret the outcome?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Parameter Estimate &amp;nbsp; StandardError t&amp;nbsp;Value Pr&amp;nbsp;&amp;gt;&amp;nbsp;|t| 95% Confidence Limits &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Intercept&lt;/TD&gt;&lt;TD&gt;-7.857818524&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;9.06399018&lt;/TD&gt;&lt;TD&gt;-0.87&lt;/TD&gt;&lt;TD&gt;0.4006&lt;/TD&gt;&lt;TD&gt;-27.29814401&lt;/TD&gt;&lt;TD&gt;11.582506960&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Treat Cont&lt;/TD&gt;&lt;TD&gt;8.641893762&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;6.20797873&lt;/TD&gt;&lt;TD&gt;1.39&lt;/TD&gt;&lt;TD&gt;0.1856&lt;/TD&gt;&lt;TD&gt;-4.672896387&lt;/TD&gt;&lt;TD&gt;21.956683911&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Treat Int&lt;/TD&gt;&lt;TD&gt;0.000000000&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Kon F&lt;/TD&gt;&lt;TD&gt;-3.063476648&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;6.43129427&lt;/TD&gt;&lt;TD&gt;-0.48&lt;/TD&gt;&lt;TD&gt;0.6412&lt;/TD&gt;&lt;TD&gt;-16.85723099&lt;/TD&gt;&lt;TD&gt;10.730277699&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Kon M&lt;/TD&gt;&lt;TD&gt;0.000000000&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PreDD&lt;/TD&gt;&lt;TD&gt;0.878227976&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0.18708534&lt;/TD&gt;&lt;TD&gt;4.69&lt;/TD&gt;&lt;TD&gt;0.0003&lt;/TD&gt;&lt;TD&gt;0.476969834&lt;/TD&gt;&lt;TD&gt;1.279486118&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV align="center"&gt;&lt;IMG width="640" height="480" alt="img0.png" border="0" /&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 10 May 2019 18:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557904#M74798</guid>
      <dc:creator>AnneSophie</dc:creator>
      <dc:date>2019-05-10T18:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557906#M74799</link>
      <description>&lt;P&gt;The LSMEANS command in PROC GLM gives much more interpretable results.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 18:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557906#M74799</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-10T18:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557912#M74800</link>
      <description>&lt;P&gt;I think what you are asking is:&lt;/P&gt;&lt;P&gt;1) how to get the treatment effect for females&lt;/P&gt;&lt;P&gt;2) how to get the treatment effect for males&lt;/P&gt;&lt;P&gt;3) how to get the difference between the treatment effect for females and treatment effect for males&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, I'd do this:&lt;/P&gt;&lt;P&gt;proc glm data=...;&lt;BR /&gt;class group;&lt;BR /&gt;model outcome=group / noint;&lt;BR /&gt;contrast 'Difference of Differences' group 1 -1 -1 1; /*if this is significant then the difference between treatment and control are different between males and females*/&lt;BR /&gt;contrast 'Male Effect' group 1 -1 0 0; /* if this is significant then the difference between treatment and control for males is significant */&lt;BR /&gt;contrast 'Female Effect' group 0 0 1 -1; /* if this is significant then the difference between treatment and control for females is significant */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;group =1 if sex=male and treatment=control&lt;/P&gt;&lt;P&gt;group =2 if sex=male and treatment=treatment&lt;/P&gt;&lt;P&gt;group =3 if sex=female and treatment=control&lt;/P&gt;&lt;P&gt;group =4 if sex=female and treatment=treatment&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 18:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557912#M74800</guid>
      <dc:creator>DWilson</dc:creator>
      <dc:date>2019-05-10T18:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557913#M74801</link>
      <description>&lt;P&gt;There's probably a way to get the same estimates as with my contrast statements using LSMEANS and a GLM model like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;class sex treat;&lt;/P&gt;&lt;P&gt;model outcome= sex treat sex*treat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I don't know them offhand.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 18:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557913#M74801</guid>
      <dc:creator>DWilson</dc:creator>
      <dc:date>2019-05-10T18:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557939#M74802</link>
      <description>&lt;P&gt;Thanks a lot, both of you. I tried the LSmeans statement, but I need to adjust for the baseline value also &amp;nbsp;(Theres some clinical important baseline differences, that might impact the potential reduction)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was told that the statement below gives the mean for the overall group differences on Diabetes distress (DD).&lt;/P&gt;&lt;P&gt;Now I want to know if the overall differnce is driven by a better effect in men or women.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach my outcome table, which might give you an idea of what I need. (The results on sex&amp;nbsp;are not correct).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;glm&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=work.log;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; treat;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Model&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; PostDD = PreDD/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;solution&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;clparm&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I think it might be a quite simple procedure - to you;-) I'm just a novice in SAS..&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Is I should use lsmeans, where in the statement should I put it. But importantly, I need to adjust for the baseline (preDD).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks Again.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;BW. Anne Sophie &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 19:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/557939#M74802</guid>
      <dc:creator>AnneSophie</dc:creator>
      <dc:date>2019-05-10T19:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/558020#M74805</link>
      <description>&lt;P&gt;I provided the proper LSMEANS statement in message 4 of this thread.&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 10:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/558020#M74805</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-11T10:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to include 2 categorial variables in a Two sample t test</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/558159#M74813</link>
      <description>&lt;P&gt;Thanks, a lot for your advice.&lt;/P&gt;&lt;P&gt;I did the;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;glm&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=work.log;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Kon treat;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; kon;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;model&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; PostDD= PreDD Kon treat/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;solution&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;clparm&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;lsmeans&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Kon treat/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;tdiff&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cl&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;And it worked for me. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I got the outcomes adjusted for baseline differences and sorted by gender.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks a lot:-)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;BW, Sophie&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 20:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-include-2-categorial-variables-in-a-Two-sample-t-test/m-p/558159#M74813</guid>
      <dc:creator>AnneSophie</dc:creator>
      <dc:date>2019-05-12T20:47:55Z</dc:date>
    </item>
  </channel>
</rss>

