Hello!
I have a data set with appointments at a dental clinic over a period of 2 months (1st of may to 1st of july). Some patients attend the clinic more than once during this period and thus occur several times in the data set. For each patient occuring more than once, I want to keep the first appointment and drop all other appointments of that patient. If a patient attends the clinic the 1st of may, the 2nd of may and the 3rd of may i want to drop the two latter observations and keep the first observation.
Using:
duplicates drop patient_id, force
will drop all duplicates. But i cannot see if it drops them in the manner i want?
If i sort the observations by date and execute the above command, will I achieve the desired results?
best regards,
I have a data set with appointments at a dental clinic over a period of 2 months (1st of may to 1st of july). Some patients attend the clinic more than once during this period and thus occur several times in the data set. For each patient occuring more than once, I want to keep the first appointment and drop all other appointments of that patient. If a patient attends the clinic the 1st of may, the 2nd of may and the 3rd of may i want to drop the two latter observations and keep the first observation.
Using:
duplicates drop patient_id, force
will drop all duplicates. But i cannot see if it drops them in the manner i want?
If i sort the observations by date and execute the above command, will I achieve the desired results?
best regards,
Comment