Support #1151
openCarrying forward variables across waves, creating 'how long lived at address' variable
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 - mvyrforeach 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
Updated by Stephanie Auty over 6 years ago
- Status changed from New to In Progress
- Assignee changed from Alita Nandi to Stephanie Auty
- % Done changed from 0 to 10
- Private changed from Yes to No
Updated by Stephanie Auty over 6 years ago
- Status changed from In Progress to Feedback
- Assignee changed from Stephanie Auty to Natasha Codiroli
- % Done changed from 10 to 60
Updated by Understanding Society User Support Team almost 3 years ago
- Status changed from Feedback to Resolved
- % Done changed from 70 to 100
Updated by Understanding Society User Support Team almost 2 years ago
- Category changed from Data analysis to Questionnaire content