title: Obtaining the Frequency of Variables in SAS
body: <p>I am attempting to determine the population number and frequency of total caloric intake among two groups of individuals (males equal to or above 3000 calories and those males equal to or below 1800 calories). However, when I attempt to break up my dataset using SAS it has an issue computing separate categories for the two groups even though in my code I request that the male variables break up between TOTALcat=1 and TOTALcat=2. Below is my code. That said, what further steps do I need to take to determine both the population number and frequency of these groups within my larger dataset? Thanks</p>
  <pre><code>libname lab &quot;C:\Users\14015\Pictures\BST #1&quot;;
  
  data nutrition;
  set 'C:\Users\14015\Pictures\BST #1\nutrition';
  run;
  
  proc contents data = nutrition;
  run;
  
  proc format;
      value sex
      1 = 'MALE'
      2 = 'FEMALE';
  run;
  
  data nutrition;
      set nutrition;
      CARBS = CARBS*4;
      FAT = FAT*9;
      PROTEIN = PROTEIN*4;
  run;
  
  data nutrition;
      set nutrition;
      TOTAL = sum(of CARBS FAT PROTEIN);
  run;
  
  proc print data = nutrition;
      var TOTAL CARBS FAT PROTEIN SEX;
  run;
  
  data nutrition;
      set nutrition;
      if sex=1 and TOTAL&gt;=3000 then TOTALcat=1;
          else sex=1 and TOTAL&lt;=1800 then TOTALcat=2;
  run;
  
  proc freq data=nutrition;
      table TOTALcat;
  run;
  </code></pre>