<?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: Please help with code for differences of sums in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625420#M184322</link>
    <description>&lt;P&gt;This is how to request a Wilcoxon test for each cat1 value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc npar1way data=have wilcoxon plots=none;
by cat1;
class sex;
var count;
output out=stats wilcoxon;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Feb 2020 20:01:45 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-02-17T20:01:45Z</dc:date>
    <item>
      <title>Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625402#M184314</link>
      <description>&lt;P&gt;I have multiple categories (Cat1) with many count data rows categorized by sex. I'd like SAS code to sum the count data by sex for each category and test whether there is a significant difference between Male and Female for the sum of counts for each category.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data look like this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Cat1&lt;/TD&gt;&lt;TD&gt;Sex&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;M&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;F&lt;/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at1 is over 6 and up to 1200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been using a MWU due to non-normal distributions, but it's restricted to one variable and I don't want to run it for each category separately if I don't have to.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625402#M184314</guid>
      <dc:creator>canolden</dc:creator>
      <dc:date>2020-02-17T19:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625403#M184315</link>
      <description>&lt;P&gt;I believe this would be a job for PROC TTEST:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ttest data=have;
    var count;
    class cat1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course, this assumes the variable count is normally distributed, and it probably isn't, but you haven't told us anything about variable COUNT. So, what is the distribution of variable count, and how many data points do you really have?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625403#M184315</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-17T19:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625406#M184317</link>
      <description>I have over 6000 data lines. This is a clip of the top of one table.&lt;BR /&gt;&lt;BR /&gt;Cat1 N&lt;BR /&gt;Sum of&lt;BR /&gt;Scores&lt;BR /&gt;Expected&lt;BR /&gt;Under H0&lt;BR /&gt;Std Dev&lt;BR /&gt;Under H0&lt;BR /&gt;Mean&lt;BR /&gt;Score&lt;BR /&gt;Dp16M 70 327670.00 230895.00 15037.6074 4681.00000&lt;BR /&gt;Do15F 89 212015.00 293566.50 16931.3502 2382.19101&lt;BR /&gt;Di9F 254 559325.50 837819.00 28238.1450 2202.06890&lt;BR /&gt;Dq17M 69 322989.00 227596.50 14930.9533 4681.00000&lt;BR /&gt;Dm13F 152 282112.00 501372.00 22019.4135 1856.00000&lt;BR /&gt;Dh8M 237 1109397.00 781744.50 27313.3376 4681.00000&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625406#M184317</guid>
      <dc:creator>canolden</dc:creator>
      <dc:date>2020-02-17T19:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625407#M184318</link>
      <description>&lt;P&gt;So perhaps I didn't word my question properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How many observations (on average) do you have for each value of CAT1, and how many of those are male and how many of those are female?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625407#M184318</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-17T19:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625411#M184320</link>
      <description>That is highly variable. There are 48 levels for the class variable, which t-test doesn't handle. The number of male counts and female counts is different for each level, varying from above 6 counts to hundreds for each sex within level.&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625411#M184320</guid>
      <dc:creator>canolden</dc:creator>
      <dc:date>2020-02-17T19:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625420#M184322</link>
      <description>&lt;P&gt;This is how to request a Wilcoxon test for each cat1 value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc npar1way data=have wilcoxon plots=none;
by cat1;
class sex;
var count;
output out=stats wilcoxon;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Feb 2020 20:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625420#M184322</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-02-17T20:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Please help with code for differences of sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625426#M184325</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/312568"&gt;@canolden&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;That is highly variable. There are 48 levels for the class variable, which t-test doesn't handle. The number of male counts and female counts is different for each level, varying from above 6 counts to hundreds for each sex within level.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;My mistake, the code ought to look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ttest data=have;
    by cat1;
    class sex;
    var count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but probably &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; has a better solution.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 20:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-with-code-for-differences-of-sums/m-p/625426#M184325</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-17T20:16:16Z</dc:date>
    </item>
  </channel>
</rss>

