<?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: Proc Ttest Error: The CLASS variable does not have two levels. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433692#M68813</link>
    <description>&lt;P&gt;I feel really dumb now haha. That was indeed the issue. I misread the documentation.&lt;/P&gt;&lt;P&gt;Thank you for dealing kindly and swiftly with my error!&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2018 20:33:17 GMT</pubDate>
    <dc:creator>BozJ3</dc:creator>
    <dc:date>2018-02-02T20:33:17Z</dc:date>
    <item>
      <title>Proc Ttest Error: The CLASS variable does not have two levels.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433660#M68810</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ttest freq table.PNG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18286iB8CC857862989BD9/image-size/small?v=v2&amp;amp;px=200" role="button" title="ttest freq table.PNG" alt="ttest freq table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run a&amp;nbsp;2 sample&amp;nbsp;ttest over a dataset using the code below:&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;=dataset&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;COCHRAN&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;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class_var;&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; dependent_var;&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 am getting the error "The CLASS variable dopes not have two levels."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I have filtered the data set such that only two values can exist for class_var; I have run a proc freq statement to ensure that only two values (and none missing) exist for the variable; I have even coded an indicator that can only take two values to use instead of class_var. The same error pops up in every case.&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;Any idea what I can try to do differently?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 18:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433660#M68810</guid>
      <dc:creator>BozJ3</dc:creator>
      <dc:date>2018-02-02T18:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Ttest Error: The CLASS variable does not have two levels.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433684#M68812</link>
      <description>&lt;P&gt;CLASS separates the groups for each BY level. You haven't specified an analysis variable, which would default to all numeric variables I believe.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To verify you actually have the groups you need two levels in each BY group, so your proc freq should really be something like the following to confirm your claim of two levels in all groups:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=dataset;
table class_var*dependent_var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps you're not quite doing the T-Test right and this is what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
proc ttest data=dataset COCHRAN;
class class_var;
Var dependent_var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/125008"&gt;@BozJ3&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ttest freq table.PNG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18286iB8CC857862989BD9/image-size/small?v=v2&amp;amp;px=200" role="button" title="ttest freq table.PNG" alt="ttest freq table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to run a&amp;nbsp;2 sample&amp;nbsp;ttest over a dataset using the code below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;ttest&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=dataset&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;COCHRAN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;class&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; class_var;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dependent_var;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&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 am getting the error "The CLASS variable dopes not have two levels."&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I have filtered the data set such that only two values can exist for class_var; I have run a proc freq statement to ensure that only two values (and none missing) exist for the variable; I have even coded an indicator that can only take two values to use instead of class_var. The same error pops up in every case.&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;Any idea what I can try to do differently?&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 20:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433684#M68812</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-02T20:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Ttest Error: The CLASS variable does not have two levels.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433692#M68813</link>
      <description>&lt;P&gt;I feel really dumb now haha. That was indeed the issue. I misread the documentation.&lt;/P&gt;&lt;P&gt;Thank you for dealing kindly and swiftly with my error!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 20:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ttest-Error-The-CLASS-variable-does-not-have-two-levels/m-p/433692#M68813</guid>
      <dc:creator>BozJ3</dc:creator>
      <dc:date>2018-02-02T20:33:17Z</dc:date>
    </item>
  </channel>
</rss>

