Project

General

Profile

Actions

Support #1151

open

Carrying forward variables across waves, creating 'how long lived at address' variable

Added by Natasha Codiroli almost 6 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Category:
Questionnaire content
Start date:
02/25/2019
% Done:

100%


Description

Hi Understanding Society Support team,

I want to create a variable that tells me how long an individual has lived at their current address. I am using data from waves 1-8 in long format.

I noticed the variable mvyr is mostly missing for waves 2-8, so am assuming it's only asked on the first instance, and again if the person has moved. I have used the code below to carry forward this data if it is missing in later waves, and to calculate the number of years they have lived at their current address.

mvdecode mvyr istrtdaty, mv(-1/-99)
gen home_yrs = istrtdaty - mvyr

foreach x in 2 3 4 5 6 7 8 {
bysort pidp(wave): replace home_yrs=home_yrs1+`x'-1 if home_yrs==. & wave==`x'
}

Can I check with you that the above calculation looks correct, or whether there is an easier way generally to carry forward response? One problem I've noticed with this calculation is that there is a much higher proportion of people who have lived in their home less than a year in wave 1 compared to later waves.

Thanks for your help,

Natasha

Actions

Also available in: Atom PDF