Hi everyone,
I have to run a diff in diff regression to analyse whether participation in a workfare programme had an impact on some outcome variable of interest (like consumption) but I am not able to create my treatment variable. In fact I have a panel dataset in the long format with observations for each household in 2 different years (one before and one after the programme was implemented). The variable that indicates that households participated in the workfare programme (IN17) is coded 1 for those who actually participated in the programme only in the post period and 0 or missing values otherwise but the diff in diff requires that treated households should be coded with 1 also in the period before while in my case I have 0s.
Does anyone know how to fix the problem?
You can see below an example of my data

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double HHBASE int HHSPLITID float YEAR int IN17
1010201010 0 2005 .
1010201010 1 2012 .
1010201020 1 2012 0
1010201020 0 2005 .
1010201030 1 2012 0
1010201030 0 2005 .
1010201040 1 2012 0
1010201040 0 2005 .
1010201050 1 2012 0
1010201050 0 2005 .
1010201060 1 2012 0
1010201060 0 2005 .
1010201070 1 2012 0
1010201070 0 2005 .
1010201080 1 2012 0
1010201080 0 2005 .
1010201090 1 2012 0
1010201090 2 2012 0
1010201090 0 2005 .
1010201100 1 2012 0
1010201100 0 2005 .
1010201110 1 2012 1
1010201110 0 2005 .
1010201120 1 2012 0
1010201120 0 2005 .
1010201130 1 2012 0
1010201130 0 2005 .
1010201140 1 2012 0
1010201140 0 2005 .
1010201150 0 2005 .
1010201160 1 2012 0
1010201160 0 2005 .
1010201170 1 2012 0
1010201170 0 2005 .
1010201180 1 2012 0
1010201180 0 2005 .
1010201190 1 2012 0
1010201190 0 2005 .
1010201200 1 2012 0
1010201200 0 2005 .
1010202010 1 2012 0
1010202010 0 2005 .
1010202020 1 2012 0
1010202020 0 2005 .
1010202030 1 2012 0
1010202030 0 2005 .
1010202040 1 2012 0
1010202040 0 2005 .
1010202050 1 2012 0
1010202050 0 2005 .
1010202060 1 2012 0
1010202060 0 2005 .
1010202070 1 2012 0
1010202070 0 2005 .
1010202080 1 2012 0
1010202080 0 2005 .
1010202090 1 2012 0
1010202090 0 2005 .
1010202100 1 2012 1
1010202100 0 2005 .
1010202110 1 2012 1
1010202110 0 2005 .
1010202120 2 2012 0
1010202120 3 2012 0
1010202120 1 2012 0
1010202120 0 2005 .
1010202130 1 2012 0
1010202130 0 2005 .
1010202140 1 2012 0
1010202140 0 2005 .
1010202150 1 2012 0
1010202150 0 2005 .
1010202160 1 2012 1
1010202160 0 2005 .
1010202170 1 2012 0
1010202170 0 2005 .
1010202180 1 2012 0
1010202180 0 2005 .
1010202190 1 2012 0
1010202190 0 2005 .
1010202200 1 2012 1
1010202200 0 2005 .
1010203010 1 2012 0
1010203010 0 2005 .
1010203020 1 2012 1
1010203020 0 2005 .
1010203030 0 2005 .
1010203040 1 2012 0
1010203040 0 2005 .
1010203050 1 2012 1
1010203050 0 2005 .
1010203060 1 2012 0
1010203060 0 2005 .
1010203070 1 2012 0
1010203070 0 2005 .
1010203080 2 2012 0
1010203080 1 2012 0
1010203080 0 2005 .
1010203090 1 2012 0
1010203090 0 2005 .
end
label values IN17 IN17
label def IN17 0 "No 0", modify
label def IN17 1 "Yes 1", modify
Thanks!