I have a dataset containing patient admissions 'numadmit' and their stay period within a facility ('startdate' and 'enddate'). Each patient has a unique 'ID' but may have many records, one for each admission. Each admission has a 'startdate' and 'enddate'. These dates may be the same for multiple admissions.
How do I sum up the number of admissions for a particular patient for a certain period?
For example, I patient 'A' has 3 different 'numadmit' each equal to 1 for that record. The time period 'startdate' to 'enddate' are the same for each of the 3 admissions but this patient also has other entries with different date. How can I sum the number of admissions (in this case the sum would equal 3) for that patient within this period and also sum the number of admissions (this sum would be in a different record for the patient) for the other time period?