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
Cs-ardlHello, I use stata code (xtdcce2 d.y , lr(l.y l.x1 l.x2) lr_options(ardl) cr(d.y d.x1 d.x2) cr_lags…
Continuous dependent variable, use of regressionI am trying do make some descriptive statistic. In my dataset I have ID, Age, time from start of bei…
expanding single observation into panel data with observations for each year an item existsDear , I want to transform my dataset into panel dataset. Currently my dataset looks like this (fi…
DATE ***Please help***Hi all, I am trying to put the day, month and year columns in one column. So the format is as foll…
Help on Thesis : Migrant wage gap Data Analysis.Hi, My thesis is on assessing the impact of nationality on workers earnings in UK. I have downloade…
Subscribe to:
Post Comments (Atom)
0 Response to Add common prefix to all variables (except key variable) when merging data
Post a Comment