Hello!
I'd like to ask for advice.
I have the following data:
I want to make a "var2" using "var1".

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id var1 var2)
1 1 0
1 1 0
1 1 0
2 0 0
2 0 0
2 0 0
3 0 1
3 1 1
3 1 1
4 1 1
4 0 1
4 1 1
end
There are only three types of var1: 1, 0, 1&0.

The conditions for making var2 are as follows.
If id has only 1 or 0 value in var1, var2 must be 0.
If id has both 1 and 0 in var1, var2 must be 1.

Thank you!