Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte survey int id byte(implicate gift_received) float gift_total byte age 1 234 5 1 15000 . 2 234 1 1 7500 76 2 234 3 1 7500 76 2 234 2 1 7500 76 1 234 2 1 15000 . 2 234 5 1 7500 76 2 234 4 1 7500 76 1 234 1 1 15000 . 2 234 0 1 7500 76 1 234 4 1 15000 . 1 234 3 1 15000 . 1 234 0 1 15000 . 2 456 2 2 0 . 1 456 0 1 50000 54 2 456 4 2 0 . 1 456 1 1 50000 54 2 456 0 2 0 . 2 456 3 2 0 . 2 456 5 2 0 . 1 456 4 1 50000 54 1 456 3 1 50000 54 1 456 2 1 50000 54 1 456 5 1 50000 54 2 456 1 2 0 . end
I would need to add 3 if the missing data is in survey 2 and subtract from 3 if the missing data is in survey 1. How do I do this?
Also, it is possible (even if not shown here) that the person gave no information on age in any of the waves . So I would have 2 missings in both waves. Or the observation has the age variable filled out for both waves In these cases I wouldn't be able to fill in the information. How would I be able to fill the information, controlling for observations that either a) have the full information or b) have none of the information? And would this method be applicable in the same way with other variables, such as a binary variable like gneder?
Comment