0
votes

I would like to replace missing values (the respondent did not answer the question) in Stata for those cases where the respondent answered at least one other question and drop those cases where all values are missing. How do I do that?

1

1 Answers

1
votes

Let's suppose that you have an identifier id and questions q1 q2 q3. All are missing if and only

missing(q1) + missing(q2) + missing(q3) == 3 

or the result of

egen nmissing = rowmiss(q1 q2 q3) 

is 3. Use a similar recipe for other numbers and names of similar variables and then apply drop.

Otherwise replacing a missing value usually means applying replace according to your desired protocol, which you do not specify.

In Stata what you call cases are customarily called observations.