<?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 Testing Difference in Mean Between Two Specific Periods in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448512#M283469</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to test&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;if the mean of two variables differ within two specific periods.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Precisely, I want to test if the mean of RSP differs in the period: 25Jan2002 through 24Feb2003, compared to the period: 25Feb2003 through 26Mar2004.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to create a 'flag' variable to distinguish both time periods. However, my log files suggests that the 'CLASS variable does not have two levels'. I am not too sure why the class flag variable does not have two levels as I have enough observations within the specified periods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;See my&amp;nbsp;codes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;set x;&lt;/P&gt;&lt;P&gt;Startdate = '25Jan2002'd &amp;lt; '24Feb2003'd &amp;lt; '24Feb2003'd;&lt;BR /&gt;Enddate = '25Feb2003'd &amp;lt; '24Feb2003'd &amp;lt; '26Mar2004'd;&lt;/P&gt;&lt;P&gt;If Startdate &amp;lt;= '24Feb2003'd &amp;lt;= Enddate then flag=1;&lt;BR /&gt;else flag = 0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ttest data=xx;&lt;BR /&gt;class flag;&lt;BR /&gt;var RSP;&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Log File:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;set x;&lt;BR /&gt;Startdate = '25Jan2002'd &amp;lt; '24Feb2003'd &amp;lt; '24Feb2003'd;&lt;BR /&gt;Enddate = '24Feb2003'd &amp;lt; '24Feb2003'd &amp;lt; '26Mar2004'd;&lt;BR /&gt;&lt;BR /&gt;If Startdate &amp;lt;= '24Feb2003'd &amp;lt;= Enddate then flag=1;&lt;BR /&gt;else flag = 0;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;NOTE: There were 6179 observations read from the data set WORK.SPVIXTWO.&lt;BR /&gt;NOTE: The data set WORK.SPVIXTWOX has 6179 observations and 34 variables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc ttest data=xx;&lt;BR /&gt;class flag;&lt;BR /&gt;var VarRSP20;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The CLASS variable does not have two levels.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;Is there an alternative way to do this or are my codes wrong?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I would&amp;nbsp;be glad to provide clarifications where necessary.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you in anticipation!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 25 Mar 2018 16:49:34 GMT</pubDate>
    <dc:creator>arii</dc:creator>
    <dc:date>2018-03-25T16:49:34Z</dc:date>
    <item>
      <title>Testing Difference in Mean Between Two Specific Periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448512#M283469</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to test&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;if the mean of two variables differ within two specific periods.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Precisely, I want to test if the mean of RSP differs in the period: 25Jan2002 through 24Feb2003, compared to the period: 25Feb2003 through 26Mar2004.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to create a 'flag' variable to distinguish both time periods. However, my log files suggests that the 'CLASS variable does not have two levels'. I am not too sure why the class flag variable does not have two levels as I have enough observations within the specified periods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;See my&amp;nbsp;codes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;set x;&lt;/P&gt;&lt;P&gt;Startdate = '25Jan2002'd &amp;lt; '24Feb2003'd &amp;lt; '24Feb2003'd;&lt;BR /&gt;Enddate = '25Feb2003'd &amp;lt; '24Feb2003'd &amp;lt; '26Mar2004'd;&lt;/P&gt;&lt;P&gt;If Startdate &amp;lt;= '24Feb2003'd &amp;lt;= Enddate then flag=1;&lt;BR /&gt;else flag = 0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc ttest data=xx;&lt;BR /&gt;class flag;&lt;BR /&gt;var RSP;&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Log File:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;set x;&lt;BR /&gt;Startdate = '25Jan2002'd &amp;lt; '24Feb2003'd &amp;lt; '24Feb2003'd;&lt;BR /&gt;Enddate = '24Feb2003'd &amp;lt; '24Feb2003'd &amp;lt; '26Mar2004'd;&lt;BR /&gt;&lt;BR /&gt;If Startdate &amp;lt;= '24Feb2003'd &amp;lt;= Enddate then flag=1;&lt;BR /&gt;else flag = 0;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;NOTE: There were 6179 observations read from the data set WORK.SPVIXTWO.&lt;BR /&gt;NOTE: The data set WORK.SPVIXTWOX has 6179 observations and 34 variables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc ttest data=xx;&lt;BR /&gt;class flag;&lt;BR /&gt;var VarRSP20;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The CLASS variable does not have two levels.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;Is there an alternative way to do this or are my codes wrong?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I would&amp;nbsp;be glad to provide clarifications where necessary.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you in anticipation!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 16:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448512#M283469</guid>
      <dc:creator>arii</dc:creator>
      <dc:date>2018-03-25T16:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Testing Difference in Mean Between Two Specific Periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448513#M283470</link>
      <description>&lt;P&gt;You need to use your date variable to determine the flags, but you haven't done that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if the variable that contains the date in data set x is named DATE, then&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;If '25jan2002'd&amp;lt;date&amp;lt;'24feb2003'd then flag=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 16:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448513#M283470</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-25T16:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Testing Difference in Mean Between Two Specific Periods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448515#M283471</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 17:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Testing-Difference-in-Mean-Between-Two-Specific-Periods/m-p/448515#M283471</guid>
      <dc:creator>arii</dc:creator>
      <dc:date>2018-03-25T17:07:59Z</dc:date>
    </item>
  </channel>
</rss>

