title: sas summing a third variable in a proc freq
body: <p>I want to create a table like below from <code>proc freq</code> or <code>proc tabulate</code> or something similar from my dataset where I have three variables: <code>andel</code> (share), <code>Aar</code> (year) and <code>Gruppe</code> (group).</p>
  
  <p>In my dataset I have about 500-thousand observations, where 1 observation represents a person. </p>
  
  <p>How do I create the table without having to programme my way through lots of datasets?</p>
  
  <p>I have tried:</p>
  
  <pre><code>proc freq data= data;
  Tables Aar*gruppe*andel / nopercent norow nocol nocum ;
  run;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>proc tabulate data= data  missing;
  class  gruppe aar andel  ;
  Table  aar*gruppe*andel   , all/ rts=180;
  run;
  </code></pre>
  
  <p>But none of this work - and it's because I want the shares (the variable <code>andel</code>) to be summed and not counted for each group <code>gruppe</code> and year <code>aar</code>. AND I DON'T want a table for each year (6 tables) of the summed <code>andel</code> for each <code>gruppe</code>. </p>
  
  <p><img src="https://i.stack.imgur.com/hWBMt.png" alt="enter image description here"></p>