<?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 run a two sample t test between two variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535063#M146877</link>
    <description>&lt;P&gt;Is this supposed to be a Paired ttest where you are looking at the differences between x and y on each row? Such as in a before/after score?&lt;/P&gt;
&lt;P&gt;That would be:&lt;/P&gt;
&lt;PRE&gt;data have;
input x  y  ;
datalines;
1  2
3  4
5  6
;
run;

proc ttest data=have;
   paired x*y;
run;&lt;/PRE&gt;
&lt;P&gt;If you are looking for two independent samples then the data would have to be restructured to include a group variable to distinguish between x and y as data source.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Feb 2019 23:40:53 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-02-12T23:40:53Z</dc:date>
    <item>
      <title>How to run a two sample t test between two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535060#M146875</link>
      <description>&lt;P&gt;I'm a new user to SAS and I want to figure out how to run a two sample test between two variables in a data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I know, the proc T-test can only use class to specify the variable with 2 class to do the 2 sample test, but I want to do 2 sample test between variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example;&lt;/P&gt;&lt;P&gt;x&amp;nbsp; y&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;5&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to test the X and Y's means with 2 sample t-test&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 23:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535060#M146875</guid>
      <dc:creator>Ritter</dc:creator>
      <dc:date>2019-02-12T23:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a two sample t test between two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535063#M146877</link>
      <description>&lt;P&gt;Is this supposed to be a Paired ttest where you are looking at the differences between x and y on each row? Such as in a before/after score?&lt;/P&gt;
&lt;P&gt;That would be:&lt;/P&gt;
&lt;PRE&gt;data have;
input x  y  ;
datalines;
1  2
3  4
5  6
;
run;

proc ttest data=have;
   paired x*y;
run;&lt;/PRE&gt;
&lt;P&gt;If you are looking for two independent samples then the data would have to be restructured to include a group variable to distinguish between x and y as data source.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 23:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535063#M146877</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-12T23:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a two sample t test between two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535064#M146878</link>
      <description>&lt;P&gt;Thanks for your help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, I want to do the two independent sample test. But I don't know how to merge two variables into one and add their origin name as a new variable in new data set at same time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you like show me some code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 23:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535064#M146878</guid>
      <dc:creator>Ritter</dc:creator>
      <dc:date>2019-02-12T23:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a two sample t test between two variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535065#M146879</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261591"&gt;@Ritter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your help !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, I want to do the two independent sample test. But I don't know how to merge two variables into one and add their origin name as a new variable in new data set at same time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you like show me some code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's one way to restructure the data for two independent samples.&lt;/P&gt;
&lt;PRE&gt;data have;
input x  y  ;
   Group='X'; Value=x;output;
   Group='Y'; value=y;output;
datalines;
1  2
3  4
5  6
;
run;

proc ttest data=have;
   class group;
   var value;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Feb 2019 23:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-a-two-sample-t-test-between-two-variables/m-p/535065#M146879</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-12T23:58:34Z</dc:date>
    </item>
  </channel>
</rss>

