Hello everyone,
I am dealing with a dataset that has variable names with the same prefix. I would like to move the contents of one variable to another using that prefix as a pattern.
Let's say I have the following varnames:
var1_x var2_x var3_x var1_y var2_y var3_y
I would like to move the contents from *_x to *_y.
I thought using a foreach or replace could solve the problem, like the following: replace *_y = *_x
But it does not work. Sure I am doing something wrong. Do you know if there is a better way?
Thank you so much!
David
I am dealing with a dataset that has variable names with the same prefix. I would like to move the contents of one variable to another using that prefix as a pattern.
Let's say I have the following varnames:
var1_x var2_x var3_x var1_y var2_y var3_y
I would like to move the contents from *_x to *_y.
I thought using a foreach or replace could solve the problem, like the following: replace *_y = *_x
But it does not work. Sure I am doing something wrong. Do you know if there is a better way?
Thank you so much!
David
Comment