What is the most efficient way to do something like:
gen newvar = 1 if v1 == 1 | v2 == 1 | v3 == 1 | v4 == 1 | v5 == 1 | v6 == 1 | v7 == 1
I tried a foreach loop, but what I really am looking for is something like a "for any" loop. I also tried -inlist- but was not successful with that.
gen newvar = 1 if v1 == 1 | v2 == 1 | v3 == 1 | v4 == 1 | v5 == 1 | v6 == 1 | v7 == 1
I tried a foreach loop, but what I really am looking for is something like a "for any" loop. I also tried -inlist- but was not successful with that.
Comment