To construct the new variable you need to use both the generate and replace commands. To create the new variable you type:
gen newvar2 = 0 replace newvar2 = 1 if gender_n == 2
The first command creates a new variable called newvar2, each observation in the data set has a value of 0 for this new variable.
The second step recodes the newvar2 values from 0 to the value 1 if the gender_n variable is equal to 2.
Does this seem right? Did you type this instead?:
replace newvar2 = 1 if gender_n == F
Continue on with Module 3 for an explanation of the above syntax.