Hello everyone,

i have a data set with the two dummy variables date4 and knowledgedum. I want to create a new dummy variable which is 1 if date4=1 and knowledgedum=1 and 0 if date 4=1 and knowledgedum=0.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(date4 knowledgedum)
1 1
0 1
0 1
0 1
0 0
1 0
0 1
0 0
0 0
0 1
end

I have already tried this code, but it gives the new dummy variable a 1 if one of the two conditions is true.

gen date4k=.
replace date4k=1 if date4==1
replace date4k=1 if statementdum==1
replace date4k=0 if date4==0
replace date4k=0 if statementdum==1



many greetings
Thomas