Hello i have
I need to find a way to calculate the var "seq"
I try
Not giving the result I want
I need to add temp value by id and year, and put info into a new var "seq".
Thanks
id | Year | temp | "seq" | |
1 | 2001 | . | 0 | |
1 | 2002 | 1 | 1 | |
1 | 2003 | 1 | 2 | |
1 | 2004 | . | 0 | |
2 | 2001 | 1 | 1 | |
2 | 2002 | 1 | 2 | |
2 | 2003 | . | 0 |
I try
Code:
sort id bys id: egen seq = anymatch(temp), value (1)
I need to add temp value by id and year, and put info into a new var "seq".
Thanks
Comment