Hi, I want to create a dummy variable (0/1) if any variable from a list (ever10-ever50) is equal to 1. What would be the best way to approach this? Thank you!
-
Login or Register
- Log in with
egen byte wanted = anymatch(ever10-ever50), values(1) egen mcount = rowmiss(ever10-ever50) replace wanted = . if mcount > 0
egen byte wanted = anymatch(ever10-ever50), values(1) egen mcount = rowmiss(ever10-ever50) replace wanted = . if mcount > 0 & wanted == 0
Comment