Hello all,
I am currently writing a research project where I investigate the effects of parental leave on employment. For this I have access to yearly data regarding the variables of interest.
However, I can only download the data per year which makes merging/appending a bit tricky. I tried to append the first year (2008) with the other years but it got very messsy.
Every survey year has an unique variable code per category e.g. income2011 to denote income in 2011 or workinghours2012 to denote the amount of hours worked per week in 2012 and so on for every variable of interest from 2008-2025. When I appended the datasets I eventually got a dataset with 5000 different variables. Does someone have an idea how to merge these datasets into one clean document? So for example I would prefer to merge all income variables per year into one income variable. I pasted a part of the code I used below and I am using Stata 18.5 on windows.
I hope someone can help me,
Diederick
use cw12e_EN_1.0p.dta, clear
gen wave = 2012
tempfile d12
save `d12'
************************************************** **
* 2013
************************************************** **
use cw13f_EN_1.0p.dta, clear
gen wave = 2013
tempfile d13
save `d13'
************************************************** **
* 2014
************************************************** **
use cw14g_EN_1.0p.dta, clear
gen wave = 2014
tempfile d14
save `d14'
use `d12', clear
append using `d13'
append using `d14'
I am currently writing a research project where I investigate the effects of parental leave on employment. For this I have access to yearly data regarding the variables of interest.
However, I can only download the data per year which makes merging/appending a bit tricky. I tried to append the first year (2008) with the other years but it got very messsy.
Every survey year has an unique variable code per category e.g. income2011 to denote income in 2011 or workinghours2012 to denote the amount of hours worked per week in 2012 and so on for every variable of interest from 2008-2025. When I appended the datasets I eventually got a dataset with 5000 different variables. Does someone have an idea how to merge these datasets into one clean document? So for example I would prefer to merge all income variables per year into one income variable. I pasted a part of the code I used below and I am using Stata 18.5 on windows.
I hope someone can help me,
Diederick
use cw12e_EN_1.0p.dta, clear
gen wave = 2012
tempfile d12
save `d12'
************************************************** **
* 2013
************************************************** **
use cw13f_EN_1.0p.dta, clear
gen wave = 2013
tempfile d13
save `d13'
************************************************** **
* 2014
************************************************** **
use cw14g_EN_1.0p.dta, clear
gen wave = 2014
tempfile d14
save `d14'
use `d12', clear
append using `d13'
append using `d14'

Comment