| 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
Specialized on Data processing, Data management Implementation plan, Data Collection tools - electronic and paper base, Data cleaning specifications, Data extraction, Data transformation, Data load, Analytical Datasets, and Data analysis. BJ Data Tech Solutions teaches on design and developing Electronic Data Collection Tools using CSPro, and STATA commands for data manipulation. Setting up Data Management systems using modern data technologies such as Relational Databases, C#, PHP and Android.
| 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 |
sort id bys id: egen seq = anymatch(temp), value (1)
0 Response to Sum Variable in colums
Post a Comment