title: Count where the value is not missing
body: <p>I want to count the occurrences of dates in a column where the value is not missing. So for example, I want to count the number of times a car has been serviced, rather then including the null values where there are no service dates.</p>
  
  <p>I tried the simple count function but it brings all the records. I thought of using 'case' but I am not sure about the syntax. I am using the SAS Enterprise Guide. </p>
  
  <p>sample date </p>
  
  <pre><code>id    car     service_Date
  1     honda   01/01/2005
  2     honda   01/01/2006
  3     honda   
  4     honda   01/01/2008
  5     honda   
  6     honda   01/01/2010
  </code></pre>
  
  <p>RESULT: I want to have only 4 as the answer so its not counting the null values.</p>
  
  <pre><code>PROC SQL;
  CREATE TABLE WORK.QUERY_FOR_CARS AS 
  SELECT 
  t1.CAR,
  t1.ID  
  /* SERVICE_DATE */
  (count (case when t1.S_DATE is not null then 0 end)) AS SERVICE_DATE
  FROM WORK.QUERY_FOR_CAR_SERVICE
  GROUP BY t1.S_DATE;
  QUIT;
  </code></pre>
  
  <p>I have added the code that I am using. It gives me the count for the dates but also includes where the date value is null.</p>