Hi, I'd appreciate if someone can provide some help for my following question: Data description: longitudinal data, edu is a dummy which 1 represents to have education in the corresponding tax year; 0 means no education. I would like to get the duration of the waiting period before a person gets education, and how many years one participates at school. For example, I would like to have a variable to show the first person waits for 1 year to start education, and stays in school for 2 years; the 2nd person waits for 0 year and stays in school for 3 years; the 4th person waits for 2 years and has been in school for 2 years. For the 3rd person, he has multiple entries for education but I would like to count only the first time (or 1 year of education). In other words, I wonder if it is possible to create a variable for only those who have attended school consecutively. I would also like to see if the mean of waiting time and years of education can be calculated directly. Many thanks!!! Sample data: id tax_year edu 1 1 0 1 2 1 1 3 1 1 4 0 1 5 0 2 1 1 2 2 1 2 3 1 2 4 0 2 5 0 3 1 0 3 2 1 3 3 0 3 4 1 3 5 0 4 1 0 4 2 0 4 3 1 4 4 1 4 5 0
... View more