Hi,
I am facing some problems in making a new variable in multiple imputed dataset.
I need to make a new variable (h) that is equal to 1 if x1-x5 are all equal to 1. Else =0 (excluding any missing on x1-x5, due to missing values in m=0 dataset).
I used the following commands, but the total observations of the variable ‘h’ in datasets m=1-100 is still equal to the total observations in m=0 dataset (basically these commands did nothing for those with missing values in datasets m=1-100).
mi xeq: gen h =1 if !missing(x1, x2, x3, x4, x5)
mi xeq: replace h=0 if (x1 == 1 & x2 == 1 & x3 == 1 & x4 == 1 & x5 == 1)
Can anyone tell how to fix this?
Thankfully,
Massao
I am facing some problems in making a new variable in multiple imputed dataset.
I need to make a new variable (h) that is equal to 1 if x1-x5 are all equal to 1. Else =0 (excluding any missing on x1-x5, due to missing values in m=0 dataset).
I used the following commands, but the total observations of the variable ‘h’ in datasets m=1-100 is still equal to the total observations in m=0 dataset (basically these commands did nothing for those with missing values in datasets m=1-100).
mi xeq: gen h =1 if !missing(x1, x2, x3, x4, x5)
mi xeq: replace h=0 if (x1 == 1 & x2 == 1 & x3 == 1 & x4 == 1 & x5 == 1)
Can anyone tell how to fix this?
Thankfully,
Massao