Hello everyone
I have a dataset with observations that have been matched, and I have a sample weight for the controls that comes from before I did this matching. So, all the treated observations have a NA in my weight variable. I need to replace those NA with the weight from the control observation that has been matched. My data looks something like this:
weight Treated _id _n1
NA 0 1 .
NA 0 2 .
NA 0 3 .
NA 0 4 .
2.654 1 5 1
10.23 1 6 2
5.378 1 7 3
8.539 1 8 4
So _id = 5 (treated) has been matched with _id = 1. I need to replace the weight in _id = 1 with the same that I have in _id = 5. So the data would look like this after the replacement:
weight Treated _id _n1
2.654 0 1 .
10.23 0 2 .
5.378 0 3 .
8.539 0 4 .
2.654 1 5 1
10.23 1 6 2
5.378 1 7 3
8.539 1 8 4

I'm having trouble with programming this replacement. I hope you can help me and thank you very much in advance