Hi everyone,
I am currently working with panel data. Lets say I have four data sets, each containing the same questions.
I start by using the data of year 1 and want to merge year 2, keeping all variables. Preferably, I want all variables to have a prefix for their year.
On the first data set, I just used rename to add my prefix to each variable and change back the name of my key variable to its old name:
rename (* a*)
rename arespid respid
Now I have a problem when I merge the data for the next year. I only know how to change all variable names, but not how to only change those of the using data set.
Is there a way to add a prefix to all variables and exclude the key variable?
I already thought of renaming, saving, clearing, using, renaming saving etc. but I guess thats a pretty complicated way of reaching my goal.
Thank you all in advance.
0 Response to Add common prefix to all variables (except key variable) when merging data
Post a Comment