Assuming 日期重疊次數 means the # of same startdate and enddate proc freq data=datset1; by ID; Table startdate/out=outdatset2; run;