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
0 Response to Sum Variable in colums
Post a Comment