Hey there,
i have the following problem: I have 5 Dummy Variables (1/0) which i want to include in only one new Variable. So my new variable should show all the observations as a 1 if one of the Dummy Variables is equal to one. What I've done so far is that i generated a new Variable which includes all the other Variables if their value is equal to 1. The problem im faced with now is that if for example two of the five Dummy Variables are equal to one, my new variable only considers one of the oberservations to be one. The result is that the number of observations equal to 1 for the new Variable are less than the total number of all observations equal to one if you add the five dummy variables with your calculator.
Here is the Code i used so far:
Code:
[gen NEWVAR = VAR1 ==1 | VAR2 ==1 | VAR3 ==1 | VAR4 ==1 | VAR5 ==1] This may be not that hard to solve but as a greenhorn im not quite sure how to deal with this problem. Thank you for your answer !
Best regards
i have the following problem: I have 5 Dummy Variables (1/0) which i want to include in only one new Variable. So my new variable should show all the observations as a 1 if one of the Dummy Variables is equal to one. What I've done so far is that i generated a new Variable which includes all the other Variables if their value is equal to 1. The problem im faced with now is that if for example two of the five Dummy Variables are equal to one, my new variable only considers one of the oberservations to be one. The result is that the number of observations equal to 1 for the new Variable are less than the total number of all observations equal to one if you add the five dummy variables with your calculator.
Here is the Code i used so far:
Code:
[gen NEWVAR = VAR1 ==1 | VAR2 ==1 | VAR3 ==1 | VAR4 ==1 | VAR5 ==1] This may be not that hard to solve but as a greenhorn im not quite sure how to deal with this problem. Thank you for your answer !
Best regards
Comment