title: aggregate by groups and report in sas
body: <p>I've gotten the data I need and simply want to present it better, more like a pivot table in excel. The current code, that gives me the right value for freq is as follows:</p>
  
  <pre><code>proc means data = d sum;  
  vars mth age freq;  
  class mth age;  
  run;
  </code></pre>
  
  <p>Variables "mth" and "age"are categories (7 groups each) and the goal was to get the sum of the variable "freq" for all of the intersections between "mth" and "age".  That was successful and the results are formatted as follows:</p>
  
  <pre><code>mth  age NObs Variable Sum
  1     1   20  mth      20
                age      20
                freq     40
        2   30  mth      30
                age      30
                freq     65
  ...    ...       ... 
  7     1   25  mth      25
                age      25
                freq     48
  </code></pre>
  
  <p>Again, the freq summation is correct with my code, i just want to display the results as follows:</p>
  
  <pre><code>  7  6  5  4  3  2  1
                           (&lt;- column sum totals) 
  1                40  40  (&lt;- intersection sums for freq) 
  2
  ...
  7
  </code></pre>
  
  <p>proc sql isnt playing nice and im not sure thats what to use anyways.  Thanks in advance for the help</p>