I really need help, I have data that looks similar to this:
I need to replace the missing values in the address variable. These are missing because there is "no change" in address, I am unsure how to replace a missing value to equal the last recorded observation for that individual (and it will be in a different wave) e.g replace the missing value in address for id= 1 and wave = 2, to be equal to 440 when id= 1 and wave =1.
id | Wave | Address | change | Previous address |
1 | 1 | 890 | no change | . |
2 | 1 | 440 | address change | 22 |
3 | 1 | 330 | no change | . |
4 | 1 | 440 | no change | . |
5 | 1 | 600 | emigrated | . |
1 | 2 | . | no change | |
2 | 2 | . | no change | |
3 | 2 | 360 | address change | 330 |
1 | 3 | 500 | adress change | 330 |
2 | 3 | . | no change | . |
I need to replace the missing values in the address variable. These are missing because there is "no change" in address, I am unsure how to replace a missing value to equal the last recorded observation for that individual (and it will be in a different wave) e.g replace the missing value in address for id= 1 and wave = 2, to be equal to 440 when id= 1 and wave =1.
Comment