Thanks. Astounding. I tested the code and it works. I am wondering whether I can ask you the logic behind the code. Please forgive me if my question is too basic. I did a few tests and try to find the logic when SAS runs this code. I think SAS handles it as kind of loop. The reason that I think so is that: before running the "else do....end" part, the code generates the total of all non-edu period, or the counts for all edu = 0. However, when the else do...end added, the periods after an edu = 1 have been deducted from the previous totals. This generates the actual waiting time. The reason I think it is a loop is from here-- the Else do changed the condition of calculating total and recalculated it. The conclusion also comes from the education_years, since when SAS run the “If edu_years >0 then …” , all edu_years are equal to zeros. I am wondering whether you can point out my understanding is correct or not. Thank you very much for your time.
... View more