Hi all, I searched on this topic, didn't find anything, but apologies if I used the wrong terms. I'm computing many scale composites. Some of them have missing data. I'm using code like this:
gen status = (status_15_r+status_16+status_17+status_18)/4
OR
egen status = rowtotal(status_15_r status_16 status_17 status_18)
replace status = status/4
1) is there a cleaner way to do the above?
2) how best can I account for missing data? I'd like to compute this scale if 3 of the 4 variables are present, and otherwise generate a missing value for the composite. Also, at present, the resulting value isn't divided by the right number of items if anything is missing.
Thank you!
gen status = (status_15_r+status_16+status_17+status_18)/4
OR
egen status = rowtotal(status_15_r status_16 status_17 status_18)
replace status = status/4
1) is there a cleaner way to do the above?
2) how best can I account for missing data? I'd like to compute this scale if 3 of the 4 variables are present, and otherwise generate a missing value for the composite. Also, at present, the resulting value isn't divided by the right number of items if anything is missing.
Thank you!
Comment