Hey,
I have a data set structured as follows
The "Variable_lagged" is what I want to achiev, but did not accomplish yet.
The amount of how often the Name-Year-Variable observation appears can be anything.
I thought of combinging [_n-1] with if but did not find a solution. I also though of collapsing the data, but this yields problems with other variables.
Thank you for your help in advance!
Julian
I have a data set structured as follows
Name | Year | Variable | Variable_lagged |
Name1 | 2000 | 0 | . |
Name1 | 2000 | 0 | . |
Name1 | 2000 | 0 | . |
Name1 | 2001 | 1 | 0 |
Name1 | 2002 | 0 | 1 |
Name1 | 2002 | 0 | 1 |
Name1 | 2003 | 0 | 0 |
Name2 | 1999 | 1 | . |
Name2 | 2000 | 0 | 1 |
The "Variable_lagged" is what I want to achiev, but did not accomplish yet.
The amount of how often the Name-Year-Variable observation appears can be anything.
I thought of combinging [_n-1] with if but did not find a solution. I also though of collapsing the data, but this yields problems with other variables.
Thank you for your help in advance!
Julian
Comment