<?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 sum one column and group by two others in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/sum-one-column-and-group-by-two-others/m-p/673584#M19457</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a big dataset with 3 values that are of interest. &lt;STRONG&gt;ID&lt;/STRONG&gt;, &lt;STRONG&gt;Visite&lt;/STRONG&gt; and &lt;STRONG&gt;WSL_Flaechen&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Visite ranges from 1 to 5 and WSL_Flaechen from 1 to 2.&lt;/P&gt;&lt;P&gt;With the following code i managed to group by Visite and count the WSL_Flaechen for each ID.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asdf2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47814i4E3C9F427DC8C822/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asdf2.png" alt="asdf2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asdf.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47815i9E22990280244C25/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asdf.png" alt="asdf.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But instead i want count of WSL_Flaechen (blue arrow) to be multiplied with the value of WSL_Flaechen (red arrow) and display the sum of that for each ID.&lt;/P&gt;&lt;P&gt;So ID 4001 has&lt;/P&gt;&lt;P&gt;(1*8 + 2*12) = 32 on Visite 1 and&lt;/P&gt;&lt;P&gt;2 + 20 = 22 on Visite 2&lt;/P&gt;&lt;P&gt;and 26 on Visite 3&lt;/P&gt;&lt;P&gt;and so on...&lt;/P&gt;&lt;P&gt;The dataset only has 1s and 2s and the WSL_Flaechen field and i cant seem to just sum them up. I only display the count of 1s and 2s in seperate fields. How to i properly use the sum function here?&lt;/P&gt;&lt;P&gt;When i try to get sum in there i get the "statistical variable other than N without analysis variable" error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Keets&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2020 22:39:53 GMT</pubDate>
    <dc:creator>Keets</dc:creator>
    <dc:date>2020-07-30T22:39:53Z</dc:date>
    <item>
      <title>sum one column and group by two others</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sum-one-column-and-group-by-two-others/m-p/673584#M19457</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a big dataset with 3 values that are of interest. &lt;STRONG&gt;ID&lt;/STRONG&gt;, &lt;STRONG&gt;Visite&lt;/STRONG&gt; and &lt;STRONG&gt;WSL_Flaechen&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Visite ranges from 1 to 5 and WSL_Flaechen from 1 to 2.&lt;/P&gt;&lt;P&gt;With the following code i managed to group by Visite and count the WSL_Flaechen for each ID.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asdf2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47814i4E3C9F427DC8C822/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asdf2.png" alt="asdf2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asdf.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47815i9E22990280244C25/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asdf.png" alt="asdf.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But instead i want count of WSL_Flaechen (blue arrow) to be multiplied with the value of WSL_Flaechen (red arrow) and display the sum of that for each ID.&lt;/P&gt;&lt;P&gt;So ID 4001 has&lt;/P&gt;&lt;P&gt;(1*8 + 2*12) = 32 on Visite 1 and&lt;/P&gt;&lt;P&gt;2 + 20 = 22 on Visite 2&lt;/P&gt;&lt;P&gt;and 26 on Visite 3&lt;/P&gt;&lt;P&gt;and so on...&lt;/P&gt;&lt;P&gt;The dataset only has 1s and 2s and the WSL_Flaechen field and i cant seem to just sum them up. I only display the count of 1s and 2s in seperate fields. How to i properly use the sum function here?&lt;/P&gt;&lt;P&gt;When i try to get sum in there i get the "statistical variable other than N without analysis variable" error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Keets&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 22:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sum-one-column-and-group-by-two-others/m-p/673584#M19457</guid>
      <dc:creator>Keets</dc:creator>
      <dc:date>2020-07-30T22:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: sum one column and group by two others</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sum-one-column-and-group-by-two-others/m-p/673587#M19458</link>
      <description>&lt;P&gt;Look at the WEIGHT or FREQ statement within the PROC instead - and double check your numbers, especially if you have any missing values or non integers.&amp;nbsp;&lt;/P&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/339812"&gt;@Keets&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a big dataset with 3 values that are of interest. &lt;STRONG&gt;ID&lt;/STRONG&gt;, &lt;STRONG&gt;Visite&lt;/STRONG&gt; and &lt;STRONG&gt;WSL_Flaechen&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Visite ranges from 1 to 5 and WSL_Flaechen from 1 to 2.&lt;/P&gt;
&lt;P&gt;With the following code i managed to group by Visite and count the WSL_Flaechen for each ID.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asdf2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47814i4E3C9F427DC8C822/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asdf2.png" alt="asdf2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asdf.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47815i9E22990280244C25/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asdf.png" alt="asdf.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But instead i want count of WSL_Flaechen (blue arrow) to be multiplied with the value of WSL_Flaechen (red arrow) and display the sum of that for each ID.&lt;/P&gt;
&lt;P&gt;So ID 4001 has&lt;/P&gt;
&lt;P&gt;(1*8 + 2*12) = 32 on Visite 1 and&lt;/P&gt;
&lt;P&gt;2 + 20 = 22 on Visite 2&lt;/P&gt;
&lt;P&gt;and 26 on Visite 3&lt;/P&gt;
&lt;P&gt;and so on...&lt;/P&gt;
&lt;P&gt;The dataset only has 1s and 2s and the WSL_Flaechen field and i cant seem to just sum them up. I only display the count of 1s and 2s in seperate fields. How to i properly use the sum function here?&lt;/P&gt;
&lt;P&gt;When i try to get sum in there i get the "statistical variable other than N without analysis variable" error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sincerely,&lt;/P&gt;
&lt;P&gt;Keets&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 22:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sum-one-column-and-group-by-two-others/m-p/673587#M19458</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-30T22:56:22Z</dc:date>
    </item>
  </channel>
</rss>

