<?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 independence in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308366#M66167</link>
    <description>&lt;P&gt;The first set of statement in PROC IML do not run any tests. They just print the proportions for a table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second set of statement require a SAS data set called COUNTS that contains the data. The code runs some tests for association on that data, but be warned that the chi-square test is not recommended for tables with small cell counts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The third set of statements doesn't make sense and is not valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the following DATA set and PROC FREQ statement will help get you started:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data counts;
length agegroup $5. status $10.;
input agegroup $ status $ count;
datalines;
Young Single    25
Young Married   15
Young Divorced   0
Older Single     2
Older Married    9
Older Divorced   3
;

proc freq data=counts order=data;
   tables agegroup*status / norow nocol chisq;
   weight Count;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 31 Oct 2016 19:43:55 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-10-31T19:43:55Z</dc:date>
    <item>
      <title>How to run independence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308303#M66142</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc IML;
agegroup = {"&amp;lt;=34","&amp;gt;34"};
status = {"Single" "Married" "Divorced"};
counts ={25 15 0,
               2 9 3};
p = counts / sum(counts);
print p[colname=status
           rowname=agegroup
		   label="Marital Status  by Age Group"
		   format=percent7.1];

&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=counts order=data;
   tables agegroup*status / expected cellchi2 norow nocol chisq;
   output out=ChiSqData n nmiss pchi lrchi;
   weight Count;
   title 'Chi-Square Tests for 3 by 5 Table of Eye and Hair Color';
run;

proc print data=ChiSqData noobs;
   title1 'Chi-Square Statistics for agegroup and status';
   title2 'Output Data Set from the FREQ Procedure';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq 
    agegroup = {"&amp;lt;=34","&amp;gt;34"};
    status = {"Single" "Married" "Divorced"};
    counts ={25 15 0,
               2 9 3};
     tables agegroupr *status 
          / chisq;

     weight counts;
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have found two code of independence test. But the form of original data,first passage, is not the same with the data which I have found. So who can tell me how to correct one of them or both.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 15:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308303#M66142</guid>
      <dc:creator>karen8169</dc:creator>
      <dc:date>2016-10-31T15:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to run independence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308366#M66167</link>
      <description>&lt;P&gt;The first set of statement in PROC IML do not run any tests. They just print the proportions for a table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second set of statement require a SAS data set called COUNTS that contains the data. The code runs some tests for association on that data, but be warned that the chi-square test is not recommended for tables with small cell counts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The third set of statements doesn't make sense and is not valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the following DATA set and PROC FREQ statement will help get you started:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data counts;
length agegroup $5. status $10.;
input agegroup $ status $ count;
datalines;
Young Single    25
Young Married   15
Young Divorced   0
Older Single     2
Older Married    9
Older Divorced   3
;

proc freq data=counts order=data;
   tables agegroup*status / norow nocol chisq;
   weight Count;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Oct 2016 19:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308366#M66167</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-10-31T19:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to run independence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308822#M66331</link>
      <description>&lt;P&gt;Can I ask the meaning of " order= data" and " weight Count" ? I've consulted the directions but still confused.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 18:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-independence/m-p/308822#M66331</guid>
      <dc:creator>karen8169</dc:creator>
      <dc:date>2016-11-02T18:42:58Z</dc:date>
    </item>
  </channel>
</rss>

