I have a dataset looking like the following table
| Var1 | Var2 | Var3 |
| 1 | 3 | 1 |
| 2 | 5 | 1 |
| 3 | 1 | 2 |
| 4 | 6 | 3 |
| 5 | 2 | 4 |
| 6 | 4 | 2 |
The entries of Var1 and Var2 are "couples", while the range of Var3 is arbitrary set between 1 and 4. I need to create a Var4 where each entry equals the value of Var3 for the corresponding entry of Var2.
My final dataset should therefore look like
| Var1 | Var2 | Var3 | Var4 |
| 1 | 3 | 1 | 2 |
| 2 | 5 | 1 | 4 |
| 3 | 1 | 2 | 1 |
| 4 | 6 | 3 | 2 |
| 5 | 2 | 4 | 1 |
| 6 | 4 | 2 | 3 |
Best
MP
0 Response to Matching variable values across rows
Post a Comment