<?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 association chi square test in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461400#M5492</link>
    <description>&lt;P&gt;Hello&lt;IMG src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" border="0" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i have the two variables AGE (41-65) and SMOKE. I am trying to see if there is an association between smoking and patients aged 65 and over vs. all others. Theres only one patient aged 65 and none over. Do i have to first create a new variable and then do the chi square test?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I'm thinking let me know if I should be doing something else please thanks!&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt; work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;HW2 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt;  work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;HW2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;INPUT&lt;/SPAN&gt; person sap AGE SMK &lt;SPAN class="token keyword"&gt;group&lt;/SPAN&gt; gender wt ht chol &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; AGE &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; AGESMK &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt;over &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; AGE &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; AGESMK &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; others&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt; work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;HW2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;freq&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
title8 &lt;SPAN class="token string"&gt;'Part H: Smoking and 65 and Over vs. All Others Association '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;WEIGHT&lt;/SPAN&gt; AGESMK&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;TABLES&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt;over&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; others&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;CHISQ&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;RUN&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 May 2018 18:57:45 GMT</pubDate>
    <dc:creator>iressa131</dc:creator>
    <dc:date>2018-05-10T18:57:45Z</dc:date>
    <item>
      <title>Association Chi Square test</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461377#M5487</link>
      <description>&lt;P&gt;Hello:)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i have the two variables AGE (41-65) and SMOKE. I am trying to see if there is an association between smoking and patients aged 65 and over vs. all others. Theres only one patient aged 65 and none over. Do i have to first create a new variable and then do the chi square test?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I'm thinking let me know if I should be doing something else please thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA work.HW2 ;
set  work.HW2;
INPUT person sap AGE SMK group gender wt ht chol ; 
if AGE = 65 then AGESMK = 65over ;
if AGE &amp;lt; 65 then AGESMK = others;
run;

DATA work.HW2;
proc freq;
title8 'Part H: Smoking and 65 and Over vs. All Others Association ';
WEIGHT AGESMK;
TABLES 65over* others/CHISQ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 18:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461377#M5487</guid>
      <dc:creator>iressa131</dc:creator>
      <dc:date>2018-05-10T18:06:06Z</dc:date>
    </item>
    <item>
      <title>association chi square test</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461400#M5492</link>
      <description>&lt;P&gt;Hello&lt;IMG src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" border="0" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i have the two variables AGE (41-65) and SMOKE. I am trying to see if there is an association between smoking and patients aged 65 and over vs. all others. Theres only one patient aged 65 and none over. Do i have to first create a new variable and then do the chi square test?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I'm thinking let me know if I should be doing something else please thanks!&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt; work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;HW2 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt;  work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;HW2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;INPUT&lt;/SPAN&gt; person sap AGE SMK &lt;SPAN class="token keyword"&gt;group&lt;/SPAN&gt; gender wt ht chol &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; AGE &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; AGESMK &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt;over &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; AGE &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; AGESMK &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; others&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt; work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;HW2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;freq&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
title8 &lt;SPAN class="token string"&gt;'Part H: Smoking and 65 and Over vs. All Others Association '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;WEIGHT&lt;/SPAN&gt; AGESMK&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;TABLES&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt;over&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; others&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;CHISQ&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;RUN&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 18:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461400#M5492</guid>
      <dc:creator>iressa131</dc:creator>
      <dc:date>2018-05-10T18:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: association chi square test</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461417#M5493</link>
      <description>&lt;P&gt;You will get a warning that 25 percent of your cells had a count of less than 5 and that Chi-square may not be the appropriate test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without data more data in your 'over 65' group&amp;nbsp;I don't think you'll find much luck. You might see if another age group such as 60+ tells you anything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if the requirement is 65 and older report insufficient data in that age group. Then go back to the sample or study&amp;nbsp;design and find out why...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You data step looks odd at worst and possibly unworkable. You have an Input statement which does not have a value for &lt;SPAN class="token number"&gt;65&lt;/SPAN&gt;over (which is an invalid&amp;nbsp;variable name) or &amp;nbsp;others. So you would get errors and missing values assigned to AGESMK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would expect that you either create a generic age group variable such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;agegroup = (age ge 65);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And use freq similar to:&lt;/P&gt;
&lt;PRE&gt;proc freq;
title8 'Part H: Smoking and 65 and Over vs. All Others Association ';
TABLES agegroup*smk/CHISQ;
RUN;&lt;/PRE&gt;
&lt;P&gt;With this case you really need to provide actual data as what you have posted is kind of hard to determine actual behavior of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 23:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461417#M5493</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-10T23:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Association Chi Square test</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461444#M5494</link>
      <description>&lt;P&gt;I merged the identical questions. Please do not clutter up the forum with multiple posts of the same question.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 22:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Association-Chi-Square-test/m-p/461444#M5494</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-10T22:55:21Z</dc:date>
    </item>
  </channel>
</rss>

