Reputation: 43
I have an spss file with education variable registered 6 times per ID number: Education_2015 Education_2016 Education_2017 Education_2018 Education_2019 Education_2020
Each education variable has different % of missing values. The education variable has an ordinal level with a min - max values, 1-8.
What i want to create is one EDUCATION variable, where missing values on Education_2020 will be filled based on the registrations from previous years in that order: Education_2019, Education_2018, Education_2017, Education_2016, Education_2015.
Thanks you for help.
I have tried to do this manually, but it become impossible as the dataset contains 40 k IDs.
Upvotes: 0
Views: 29
Reputation: 11360
If I understand right you want to fill each empty year with the value of the previous one. This code will do it:
compute tmp=$sysmis.
do repeat edu=Education_2015 to Education_2020.
if not missing(edu) tmp=edu.
if missing(edu) edu=tmp.
end repeat.
Upvotes: 1