Hello, I am a new user of SAS so that my question may be very easy but unfortunately I do not know the aswer. I will appreciate for any of your suggestions. Thank you very much for your time and Merry Christmas! The following is the description of the dataset and the results that I would like to find: Data description: longitudinal data, edu is a dummy which 1 represents to have education in the corresponding tax year; 0 not. I would like to get (1) the duration of the waiting period for a person to go to education, and the number of years s/he participated in education. (2) Also, the mean of the waiting time and the number of years in edu for all people. For (1), I would like to have a variable to show the first person wait for 1 year to start education, and stay in school for 2 years; the 2nd person waits 0 year and stay in school for 3 years, 4th wait for 2 years and in school for 2 years. For person 3, he has multiple entry of education but I would like to count only the first time and treat the 2nd or any furhter edu as no edu in the period. For (2), I would like to think it is good if the mean of waiting time and years of edu can be calculated directly. 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 5 5 0
... View more