Hey!
I have 9 different variables that I want to sum up. But I only want to sum the 1's.
I tried: egen new_varname = rowtotal(var1-var9) if var1-var9==1
But that is giving me missing values since not all observations==1.
If there e.g. three 1's in the var range, the number I should get is 3.
Can someone help?
Thanks so much.
Claudia
I have 9 different variables that I want to sum up. But I only want to sum the 1's.
I tried: egen new_varname = rowtotal(var1-var9) if var1-var9==1
But that is giving me missing values since not all observations==1.
If there e.g. three 1's in the var range, the number I should get is 3.
Can someone help?
Thanks so much.
Claudia