Dear Stata Community,

I'm trying to 'count the number of years each person attended the conference over the period of 20 years'. Datasets year's values are oftentimes repeated its because when a person attends the conference more than once a year. I tried 'collapse (count) Year, by (Attendance Persons)', however, as expected, the code is also counting the repeated years giving me more than 20 years of attendance for some of the people in the dataset. I would really appreciate if you could show me some guidance to fix the problem.

This is my first post and I'm very new to the Stata. Please let me know if I'm being unclear.

Thank you so much in advance.

Best wishes,
David