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.
Related Posts with Add common prefix to all variables (except key variable) when merging data
Fam MacBeth two stage regression Dear sir, following is the command for Fam MacBeth two stage regression with Newey-West standard er…
How can I change the scale of the y-axis in a Barchart Hello, I would be very grateful if someone could help me with the scale of the y-axis of my barcha…
I would like to add up value label 2+3 4+5 and 6+7 to have 1,2,3,4 in the endAs u can see in the photo, I have 7 value labels. I would like to add up value label 2+3 4+5 and 6+7…
Generate and replace multiple variables based on original variables.Hello Statalist, Hope everyone is doing fine in the middle of this pandemic. I'm working with a da…
See change in composition of traded goods according to Product Complexity IndexDear Statalisters, I want to measure the influence of trade agreements on the composition of the tr…
Subscribe to:
Post Comments (Atom)
0 Response to Add common prefix to all variables (except key variable) when merging data
Post a Comment