| year | groupID | personID | X | Y | 
| 2005 | 100 | 1 | 1 | 0 | 
| 2005 | 100 | 2 | 0 | 1 | 
| 2006 | 101 | 1 | 0 | 1 | 
| 2006 | 101 | 2 | 1 | 0 | 
Creating new variables depending on existing ones
Hi everyone. I have four variables in the dataset: year, groupID, personID and X. I would like to create a new variable Y such that within each year and each group, Y equals the value of X of personID==2. I was thinking about using egen and for loop. Thanks!
0 Response to Creating new variables depending on existing ones
Post a Comment