Hi,
I am trying to replace several variable values with other several variable values for one specific observation only (e.g. Person X).
Data set looks similar to this (but with more variables)
It would be great if it would look like this:
As in the data example shown here, the ending of the variables that should be matched/replaced are the same.
So in simple terms, the code would be
replace aggreg_var1 = aggall_var1 if person = "X"
But I was wondering if there is a way to do this for all variables at the same time?
Many thanks,
Alex
I am trying to replace several variable values with other several variable values for one specific observation only (e.g. Person X).
Data set looks similar to this (but with more variables)
person | aggall_var1 | aggall_var2 | aggall_var3 | aggreg_var1 | aggreg_var2 | aggreg_var3 |
X | 1 | 2 | 3 | 4 | 5 | 6 |
person | aggall_var1 | aggall_var2 | aggall_var3 | aggreg_var1 | aggreg_var2 | aggreg_var3 |
X | 1 | 2 | 3 | 1 | 2 | 3 |
So in simple terms, the code would be
replace aggreg_var1 = aggall_var1 if person = "X"
But I was wondering if there is a way to do this for all variables at the same time?
Many thanks,
Alex
Comment