I am currently attempting to create a group id based on the results of psmatch with 3 nearest neighbor matches.
Simplified version of my data:
The freq variable is because we currently are running this with replacement, so I have used expand for to create duplicates of those control observations that are used multiple times. n1, n2, n3 all represent the ids of control observations that were matched to the treated id.
I am currently stuck on how to possibly group these observations together. Ideally, I am looking for something that would look like:
If it makes the solution any easier, we are also considering running this match without replacement, so we wouldn't have duplicated ids used.
Simplified version of my data:
Code:
clear input float(id freq n1 n2 n3 treated) 1 1 2 4 5 1 2 2 . . . 0 2 2 . . . 0 3 1 6 2 7 1 4 1 . . . 0 5 1 . . . 0 6 1 . . . 0 7 1 . . . 0 end
I am currently stuck on how to possibly group these observations together. Ideally, I am looking for something that would look like:
Code:
+----------------------------------------------+ | id freq n1 n2 n3 treated groupid | |----------------------------------------------| 1. | 1 1 2 4 5 1 1 | 2. | 2 2 . . . 0 1 | 3. | 2 2 . . . 0 2 | 4. | 3 1 6 2 7 1 2 | 5. | 4 1 . . . 0 1 | |----------------------------------------------| 6. | 5 1 . . . 0 1 | 7. | 6 1 . . . 0 2 | 8. | 7 1 . . . 0 2 | +----------------------------------------------+
Comment