title: In SAS, how do get distinct counts of a variable that has multiple observations for each individual?
body: <p>A simple question, but I have three variables in my dataset: ID, ICDCode, and a Visit Date. There are multiple occurrences of each ICDCode per person(ID). How do I obtain a total, distinct count of icdcodes for the entire dataset, without counting a certain ICDCode twice for an individual? For example, I want to say that there are 100 cases of Heart Disease in my dataset (without counting heart disease 10 times for the same person).<br />
  Below is code I have tried:</p>
  <pre><code>    proc freq data= cases;
      table ICDCode;
      run;
  
      proc sql;
      select ICDCode,
      count(*) as Frequency
      from cases
      group by ID;
      quit;
      
  </code></pre>