'How to replace variable checking values of several variables

I have a variable in Stata named math_subject with values 1 and 2. Now I want to replace the values in the variable math_subject = 0 if other 30 variables == 2. I am asking for a short way to do this.

replace math_subject = 0 if all 30 variables with different naming format == 2.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source