I have a data set containing a series of 5 questions with 3 response options each (Yes, No, I don't know) as follows:
I want to generate a new variable with the number of times each participant chose IDK. Something like this:
Is there any way I can do this using egen?
| ID | Q1 | Q2 | Q3 | Q4 | Q5 |
| 101 | Yes | IDK | Yes | Yes | Yes |
| 102 | Yes | No | Yes | No | Yes |
| 103 | Yes | No | Yes | IDK | Yes |
| 104 | No | No | No | Yes | Yes |
| 105 | Yes | Yes | Yes | Yes | Yes |
| 106 | Yes | IDK | IDK | IDK | IDK |
I want to generate a new variable with the number of times each participant chose IDK. Something like this:
| ID | #IDK |
| 101 | 1 |
| 102 | 0 |
| 103 | 1 |
| 104 | 0 |
| 105 | 0 |
| 106 | 4 |

Comment