Hi,

I have 5 dummy variables taking the value 0 if No and 1 if Yes and in some cases 8 if the value is not reported. I am trying to create a new single variable that will give the proportion of respondents who have answered yes. However, I facing a tough time in generating it.

I have tried to use: gen Total = a + b + c +d + e ; and then: egen Total2 = mean( 100 * (Total)). These commands have not worked. I also tried to group the variables but the grouped variable did not work for me.

*Edit* I forgot to include the household id variable: 'h'

Using dataex, I have attached a small sample of the dataset.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(a b c d e)
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 1 0 1
0 1 0 0 1
0 0 1 1 1
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 1 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 1 0 1
1 1 0 0 0
1 1 1 0 0
0 1 1 0 0
0 0 1 0 0
0 1 0 0 0
1 1 1 1 1
0 1 1 0 1
0 0 0 0 0
1 1 1 1 1
1 1 0 0 0
8 1 8 1 0
1 1 1 1 1
0 1 0 0 0
1 1 1 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 0 1
0 1 0 1 0
1 1 0 0 0
1 1 1 0 0
0 0 0 0 0
0 1 1 0 1
1 0 0 0 0
0 0 0 0 0
1 1 1 0 1
1 1 0 0 0
0 1 1 8 0
0 1 0 0 0
0 1 1 1 0
1 1 1 8 0
1 0 0 0 0
0 1 1 0 0
1 1 1 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 1 0 0 0
1 1 1 1 1
0 1 0 0 0
1 0 0 1 0
0 0 0 0 0
1 1 1 0 0
0 0 0 0 0
0 1 1 1 0
0 0 1 0 0
1 1 1 0 0
1 1 1 0 1
1 1 1 0 0
1 1 1 1 1
1 1 1 0 1
1 1 0 0 0
0 1 1 1 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 1 1 1 1
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 1 1 0 0
1 1 0 0 0
0 0 0 0 0
0 0 0 0 0
1 1 1 1 0
1 1 1 0 0
0 1 1 0 0
0 1 1 0 0
0 0 0 0 0
0 0 0 0 0
1 1 1 0 0
0 1 0 0 0
0 1 1 0 0
1 1 1 1 1
0 1 1 0 0
0 1 0 0 0
0 1 0 0 1
0 1 1 0 0
1 1 1 0 0
0 0 0 0 0
0 1 0 0 0
end
label values a A
label def A 0 "no", modify
label def A 1 "yes", modify
label def A 8 "don't know", modify
label values b B
label def B 0 "no", modify
label def B 1 "yes", modify
label values c C
label def C 0 "no", modify
label def C 1 "yes", modify
label def C 8 "don't know", modify
label values d D
label def D 0 "no", modify
label def D 1 "yes", modify
label def D 8 "don't know", modify
label values e E
label def E 0 "no", modify
label def E 1 "yes", modify