<?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: Apply Cochran test on a long dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785329#M250622</link>
    <description>Thank you, this method is working very well!</description>
    <pubDate>Fri, 10 Dec 2021 08:33:42 GMT</pubDate>
    <dc:creator>tSAS1</dc:creator>
    <dc:date>2021-12-10T08:33:42Z</dc:date>
    <item>
      <title>Apply Cochran test on a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785174#M250561</link>
      <description>&lt;P&gt;I have the dataset below, and I want to know if there is a difference in Response between&amp;nbsp;SoilTest, Irrigati, MowHeigh and Clipping, but I want to use the long format of the data:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data data;
   input Practice $ Student $ Response $;
   datalines;
 SoilTest     a         Yes
 SoilTest     b         No
 SoilTest     c         Yes
 SoilTest     d         Yes
 SoilTest     e         No
 SoilTest     f         Yes
 SoilTest     g         Yes
 SoilTest     h         Yes
 SoilTest     i         No
 SoilTest     j         Yes
 SoilTest     k         Yes
 SoilTest     l         Yes
 SoilTest     m         Yes
 SoilTest     n         Yes
 Irrigation   a         Yes
 Irrigation   b         No
 Irrigation   c         No
 Irrigation   d         No
 Irrigation   e         No
 Irrigation   f         No
 Irrigation   g         No
 Irrigation   h         No
 Irrigation   i         Yes
 Irrigation   j         No
 Irrigation   k         No
 Irrigation   l         No
 Irrigation   m         No
 Irrigation   n         No
 MowHeight    a         Yes
 MowHeight    b         No
 MowHeight    c         Yes
 MowHeight    d         Yes
 MowHeight    e         Yes
 MowHeight    f         Yes
 MowHeight    g         Yes
 MowHeight    h         Yes
 MowHeight    i         No
 MowHeight    j         Yes
 MowHeight    k         Yes
 MowHeight    l         Yes
 MowHeight    m         Yes
 MowHeight    n         Yes
 Clippings    a         Yes
 Clippings    b         No
 Clippings    c         No
 Clippings    d         Yes
 Clippings    e         Yes
 Clippings    f         No
 Clippings    g         No
 Clippings    h         Yes
 Clippings    i         Yes
 Clippings    j         Yes
 Clippings    k         Yes
 Clippings    l         No
 Clippings    m         Yes
 Clippings    n         No
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Actually this code working, but with changing the shape of the table:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sort data=data;by student;run;

proc transpose data=data out=data_test(drop=_NAME_);
ID Practice;
BY student;
VAR Response;
run;

proc freq data=data_test;
   tables SoilTest Irrigati MowHeigh Clipping/nocum;
   tables SoilTest*Irrigati*MowHeigh*Clipping/agree noprint;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tSAS1_0-1639066411813.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66565i3151B0F96BEE12DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tSAS1_0-1639066411813.png" alt="tSAS1_0-1639066411813.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there any possibility to have the same pvalue of Cochran test, without changing the shape of the data, it means :using the long format of data without doing transpose ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 16:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785174#M250561</guid>
      <dc:creator>tSAS1</dc:creator>
      <dc:date>2021-12-09T16:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Cochran test on a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785206#M250571</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/335492"&gt;@tSAS1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe that a DATA step can be used to compute the test statistic and p-value, as was demonstrated for a different dataset in&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Computing-multiway-tables-using-indexed-variables-and-proc-freq/m-p/772883/highlight/true#M245438" target="_blank" rel="noopener"&gt;Re: Computing multiway tables using indexed variables and proc freq&lt;/A&gt;. But I'm not sure why you wouldn't use your existing approach using PROC TRANSPOSE and PROC FREQ, unless your real dataset is much larger so that the DATA step might outperform PROC FREQ.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 16:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785206#M250571</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-12-09T16:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Cochran test on a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785207#M250572</link>
      <description>&lt;P&gt;Hello thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually I want to use that code in a macro, so it will not be easy to enter each variable (modalities of Practice variable) in proc freq&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 17:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785207#M250572</guid>
      <dc:creator>tSAS1</dc:creator>
      <dc:date>2021-12-09T17:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Cochran test on a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785222#M250581</link>
      <description>&lt;P&gt;You can use programming to generate the table statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort;
   by student practice;
   run;
proc transpose data=data out=data_test(drop=_NAME_);
   ID Practice;
   BY student;
   VAR Response;
   run;
proc print;
   run;
proc transpose data=data_test(obs=0 drop=Student) out=practice;
   var _all_;
   run;
proc sql noprint;
   select _name_,_name_ into :agree SEPARATED '*',:oneway SEPARATED ' ' from practice;
   quit;
%put NOTE: &amp;amp;=agree &amp;amp;=oneway;

proc freq data=data_test;
   tables &amp;amp;oneway / nocum;
   tables &amp;amp;agree/agree ;
   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/335492"&gt;@tSAS1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually I want to use that code in a macro, so it will not be easy to enter each variable (modalities of Practice variable) in proc freq&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 18:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785222#M250581</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2021-12-09T18:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Cochran test on a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785329#M250622</link>
      <description>Thank you, this method is working very well!</description>
      <pubDate>Fri, 10 Dec 2021 08:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Apply-Cochran-test-on-a-long-dataset/m-p/785329#M250622</guid>
      <dc:creator>tSAS1</dc:creator>
      <dc:date>2021-12-10T08:33:42Z</dc:date>
    </item>
  </channel>
</rss>

