title: SAS: how to properly use intck() in proc sql
body: <p>I have the following codes in SAS:</p>
  
  <p><code>proc sql;
  create table play2
  as select a.anndats,a.amaskcd,count(b.amaskcd) as experience
  from test1 as a, test1 as b
  where a.amaskcd = b.amaskcd and intck('day', b.anndats, a.anndats)&gt;0
  group by a.amaskcd, a.ANNDATS;
  quit;</code></p>
  
  <p>The data test1 has 32 distinct obs, while this play2 only returns 22 obs. All I want to do is for each obs, count the number of appearance for the same amaskcd in history. What is the best way to solve this? Thanks. </p>