The 10 observations shown in my dataex are taken from my dataset
The variables X1, X2, X3, X4, and X5 are the different variables used to calculate the variable “value”
The formula for calculating a value = X1 + X2 - X3 - X4 + X5
I needed to calculate this value using the above formula
I used the gen function as follows
gen Calucated_value = X1 + X2 - X3 - X4 + X5
As you can see in my file above, whenever I have missing values in one of my variables, the generated calculated value that is shown in the variable “Calculated value” is not equal to my “value” variable. In other words, whenever I have missing values in one of my variables, the calculated value is missing. I don’t want this to happen, unless all the variables X1, X2, X3, X4, and X5 are missing.
Would you please let me know how to address this issue?
Thank you very much, and looking forward to your advice
Comment