I am sure I am missing something obvious but I looked up on the forum and online and I haven't been able to find a solution to this seemingly elementary problem.
To illustrate what I am trying to do, below is the idea.
Code:
input id year_test tested 1 2001 . 1 2002 1 1 2003 . 1 2004 1 1 2005 1 1 2006 . 2 2001 . 2 2002 . 2 2003 . 2 2004 1 2 2005 1 2 2006 . end bysort id: gen n=_n if tested!=.
Could you possibly suggest how to do this?
Thanks in advance for your help!
0 Response to Indexing observations for a subject while skipping missing values
Post a Comment