Hello!
I have two dummy variables - RSBY (the intervention) and year. I have a third variable HH which uniquely identifies each household in both years. The household can either be exposed to the treatment, in which case it is 'treated'. I want to create a 'treated' variable that is equal to 1 in both years 0 and 1 if RSBY is equal to 1 in year 1 but I can't quite figure out how to get it to equal 1 in year 0 if it is equal to 1 in year.
The data that I am using was not consistent in how they collected their responses so I am unsure if the code may be a bit more complicated? Basically, they collected multiple responses within the same household in the second wave of data (year 1) but have labelled them all under the same unique household code.
I can't copy paste an example of my data properly for some reason but it is basically like this:
HH, year, RSBY
1 , 0 , 0
2 , 0 , 0
3 , 0 , 0
4 , 0 , 0
5 , 0 , 0
1 , 1 , 0
2 , 1 , 1
2 , 1 , 1
3 , 1 , 1
3 , 1 , 1
3 , 1 , 1
4 , 1 , 0
5 , 1 , 1
I hope this makes sense, thank you in advance!
I have two dummy variables - RSBY (the intervention) and year. I have a third variable HH which uniquely identifies each household in both years. The household can either be exposed to the treatment, in which case it is 'treated'. I want to create a 'treated' variable that is equal to 1 in both years 0 and 1 if RSBY is equal to 1 in year 1 but I can't quite figure out how to get it to equal 1 in year 0 if it is equal to 1 in year.
The data that I am using was not consistent in how they collected their responses so I am unsure if the code may be a bit more complicated? Basically, they collected multiple responses within the same household in the second wave of data (year 1) but have labelled them all under the same unique household code.
I can't copy paste an example of my data properly for some reason but it is basically like this:
HH, year, RSBY
1 , 0 , 0
2 , 0 , 0
3 , 0 , 0
4 , 0 , 0
5 , 0 , 0
1 , 1 , 0
2 , 1 , 1
2 , 1 , 1
3 , 1 , 1
3 , 1 , 1
3 , 1 , 1
4 , 1 , 0
5 , 1 , 1
I hope this makes sense, thank you in advance!
Comment