I've been asked to generate a new variable, a dummy variable, using two already created dummy variables. I know how to generate simple stuff like for instance:

if I wanted to create age-squared I'd just take the variable age and type into STATA gen age2 = Age^2

But generating this dummy variable is proving difficult. I have been using trial and error for 2 hours now and got almost nowhere.

I am trying to generate a dummy variable called "samesex1", where 1 equals the cases where a mother's first two kids she's given birth to are of the same sex, and 0 equals the observations where the mother has given birth to a child on two occasions, but they are of different sex to each other.

The two already created dummy variables mentioned earlier are "boy1st" and "boy2nd".

"boy1st" is a dummy variable representing the first child a mother has had, where 1 equals a boy and 0 equals a girl. "boy2nd" is a dummy variable representing the second child the same mother has had, where 1 equals a boy and 0 equals a girl.

So how do I create this dummy variable "samesex1"? I know that values assigned to 1 for "samesex1" are cases where the values for "boy1st" and "boy2nd" take the same value for any given observation. So basically where "boy1st" and "boy2nd" both equal 1 or both equal 0. I also know that values assigned 0 to the generated variable "samesex1" are where values for any given observation for "boy1st" and "boy2nd" are different, so where "boy1st" is equal to 1 and "boy2nd" is equal to 0, vice versa.

I am stumped as to how to generate this variable "samesex1" using the two dummy variables "boy1st" and "boy2nd". Please help.