<?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: code for chi square test from cards input in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731196#M28420</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44188"&gt;@Khalid2015&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello , I have 2 groups (endovascular and surgical ) each one has good outcome and bad outcome , how can I calculate chi square for the difference between the two groups ? I am inputing these in SAS:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data procedure;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;input&amp;nbsp; procedrue $&amp;nbsp; &amp;nbsp; good_outcome&amp;nbsp; &amp;nbsp; &amp;nbsp;bad_outcome ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;cards;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;surgical 500&amp;nbsp; 200&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;endovascular 300 150&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Chi-squares don't do 'difference between groups', they test difference in distributions between groups.&lt;/P&gt;
&lt;P&gt;To do "difference between groups" you need to define how you are getting "difference".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps:&lt;/P&gt;
&lt;PRE&gt;data procedure;
   input  procedure $12. good_outcome bad_outcome;
   outcome='Good'; 
   freq=good_outcome;
   output;
   outcome='Bad';
   freq=bad_outcome;
   output;
cards;
surgical     500 200
endovascular 300 150
;
run;

proc freq data=procedure;
   tables procedure*outcome/ chisq;
   weight freq;
run;&lt;/PRE&gt;
&lt;P&gt;Note creating a single variable with two levels from two variables. Using a frequency count to maintain the sample size information (more or less). This will generally be the better way to prepare data for most of the analysis procedures in SAS.&lt;/P&gt;</description>
    <pubDate>Sun, 04 Apr 2021 06:08:20 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-04-04T06:08:20Z</dc:date>
    <item>
      <title>code for chi square test from cards input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731185#M28418</link>
      <description>&lt;P&gt;Hello , I have 2 groups (endovascular and surgical ) each one has good outcome and bad outcome , how can I calculate chi square for the difference between the two groups ? I am inputing these in SAS:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;data procedure;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;input&amp;nbsp; procedrue $&amp;nbsp; &amp;nbsp; good_outcome&amp;nbsp; &amp;nbsp; &amp;nbsp;bad_outcome ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;cards;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;surgical 500&amp;nbsp; 200&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;endovascular 300 150&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 04:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731185#M28418</guid>
      <dc:creator>Khalid2015</dc:creator>
      <dc:date>2021-04-04T04:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: code for chi square test from cards input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731192#M28419</link>
      <description>&lt;P&gt;A CHI-SQUARE test can be requested by using the FREQ procedure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data procedure;
input  procedure $12. good_outcome bad_outcome;
cards;
surgical     500 200
endovascular 300 150
;
run;


proc freq data=work.procedure (where=(procedure="surgical")); /*or endovascular*/
table bad_outcome*good_outcome / chisq;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Apr 2021 05:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731192#M28419</guid>
      <dc:creator>qoit</dc:creator>
      <dc:date>2021-04-04T05:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: code for chi square test from cards input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731196#M28420</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44188"&gt;@Khalid2015&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello , I have 2 groups (endovascular and surgical ) each one has good outcome and bad outcome , how can I calculate chi square for the difference between the two groups ? I am inputing these in SAS:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;data procedure;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;input&amp;nbsp; procedrue $&amp;nbsp; &amp;nbsp; good_outcome&amp;nbsp; &amp;nbsp; &amp;nbsp;bad_outcome ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;cards;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;surgical 500&amp;nbsp; 200&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;endovascular 300 150&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Chi-squares don't do 'difference between groups', they test difference in distributions between groups.&lt;/P&gt;
&lt;P&gt;To do "difference between groups" you need to define how you are getting "difference".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps:&lt;/P&gt;
&lt;PRE&gt;data procedure;
   input  procedure $12. good_outcome bad_outcome;
   outcome='Good'; 
   freq=good_outcome;
   output;
   outcome='Bad';
   freq=bad_outcome;
   output;
cards;
surgical     500 200
endovascular 300 150
;
run;

proc freq data=procedure;
   tables procedure*outcome/ chisq;
   weight freq;
run;&lt;/PRE&gt;
&lt;P&gt;Note creating a single variable with two levels from two variables. Using a frequency count to maintain the sample size information (more or less). This will generally be the better way to prepare data for most of the analysis procedures in SAS.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Apr 2021 06:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731196#M28420</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-04T06:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: code for chi square test from cards input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731311#M28429</link>
      <description>&lt;P&gt;hi&amp;nbsp; qoit, I do not think this would solve. I need to compare &lt;FONT color="#0000FF"&gt;surgical vs Endovacular. &lt;FONT color="#000000"&gt;the "where" statemnt restricts one of the groups from the analysis&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 03:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/code-for-chi-square-test-from-cards-input/m-p/731311#M28429</guid>
      <dc:creator>Khalid2015</dc:creator>
      <dc:date>2021-04-05T03:59:41Z</dc:date>
    </item>
  </channel>
</rss>

