I want to create a binary variable using for loop. The setup is that my binary variable, say "a", will take the value 1 if any one of the variables b,c or d take the value 5. I tried doing it using a local macro for b,c,d. But I found that stata is only reading variable b and not the other ones. I know this can be easily done using a replace and generate commands, but I am new to writing loops and hence want to learn this approach.
-
Login or Register
- Log in with
Comment