Hi everyone.
Recently I was handed a survey-dataset where one variable was missing for about 30% of the respondents. This was because this question was added to the survey later. In short, they realised that in their survey about working with traffic safety in work, one should also ask for whether or not the person is directly or indirectly working with traffic safety. Based on all of the other variables in the dataset I can predict this missing data, and have done so using multiple imputations. I'm not sure it's relevant to the question, but better safe than sorry I include it here.
My problem is that in our report, we are reporting on the proportion of respondents that are replying "Agree"/"Disagree"/"Neigher or" ect. to some relevant items. The project manager wants to exclude respondents who responded they do not directly or indirectly work with traffic safety in these descriptive statistics. My initial idea was to use something akin to
and/ or
Naturally, as the "if" condition excludes a different amount of respondents across imputations, this throws out the error code "estimation sample varies between m=1 and m=2; click here for details".
I though this was going to be somewhat simple, but I find myself stuck. Does anyone know of a solution to display means and proportions while excluding respondents based on imputed variables?
Recently I was handed a survey-dataset where one variable was missing for about 30% of the respondents. This was because this question was added to the survey later. In short, they realised that in their survey about working with traffic safety in work, one should also ask for whether or not the person is directly or indirectly working with traffic safety. Based on all of the other variables in the dataset I can predict this missing data, and have done so using multiple imputations. I'm not sure it's relevant to the question, but better safe than sorry I include it here.
Code:
mi set wide mi register impute works_directly_safety works_indirectly_safety relevant_question_1 relevant_question_2 relevant_question_3 relevant_question_4 relevant_question_5 mi impute monotone (regress) works_directly_safety works_indirectly_safety relevant_question_1 relevant_question_2 relevant_question_3 relevant_question_4 relevant_question_5, add(50) rseed(1923)
Code:
mi estimate: proportion relevant_question_1 if works_directly_safety > 3 | works_indirectly_safety > 3
Code:
mi estimate: mean relevant_question_1 if works_directly_safety > 3 | works_indirectly_safety > 3
I though this was going to be somewhat simple, but I find myself stuck. Does anyone know of a solution to display means and proportions while excluding respondents based on imputed variables?
Comment