Propensity score matching with panel data I have a longitudinal data set of individuals and some of them were subject to a treatment and others were not. All individuals are in the sample from birth until age 18 and the treatment happens at some age in between that range. The age of the treatment may differ across cases. Using propensity score matching I would like to match treated and control units in pairs with exact matching on the year of birth such that I can track each pair from their birthyear until age 18. All in all there are about 150 treated and 4000 untreated individuals. After the matching the idea is to use a difference-in-differences strategy to estimate the effect of the treatment.
The problem I face at the moment is to do the matching with panel data. I am using Stata's psmatch2 command and I match on household and individual characteristics using propensity score matching. In general with panel data there will be different optimal matches at each age. As an example: if A is treated, B and C are controls, and all of them were born in 1980, then A and B may be matched in 1980 at age 0 whilst A and C are matched in 1981 at age 1 and so on. Also A may be matched with its own pre-treatment values from previous years.
To get around this issue, I took the average of all time-varying variables such that the matching can identify individuals who are on average the most similar over the duration of the sample and I do the matching separately for each age group 0 to 18. Unfortunately this still matches a different control unit to each treated unit per age group.
If someone could direct me towards a method to do pairwise matching with panel data in Stata this would be very much appreciated.
 A: There's no way to do that in Stata or any other software that I am aware of.
If you're trying to patch up a biased matching estimator with panel data techniques, here's one approach that may work. If you can assume that matching takes care of some, but not all of the selection bias, but that the bias largely remains constant over time, you can remove the time-invariant portion of the bias by constructing separate matching estimates in each period and taking the difference.
Let $t$ be the pre-treatment period and $t'$ be the post. If the untreated state outcome $Y_0$ satisfies
\begin{equation}
E[Y_{0t} \vert X, D=1]-E[Y_{0t} \vert X, D=0]=E[Y_{0t'} \vert X, D=1]-E[Y_{0t'} \vert X, D=0]=Bias,
\end{equation}
then if $\Delta^{M}_{t'}=\Delta^{TT}+Bias$ and $\Delta^{M}_{t}=Bias$,
you can get $\Delta^{M}_{t'}-\Delta^{M}_{t}=\Delta^{TT}$
Heckman, Ichimura, Smith and Todd 1998 Econometrica and Eichler and
Lechner 2002 Labour Economics papers are examples of this approach. On the other hand, 150 treated observations may not be enough for this approach to work.
A: You basically have to create a wide format dataset with the all the characteristics that are relevant for the matching procedure, perform the matching on this cross-sectional dataset, and then use the ID to identify the matched pair in the panel dataset. Here are some more details:


*

*Use reshape to create a wide format dataset. Format the pre-treatment variables in the way you want to use them in the matching procedure. You can just take the average of your variables if you have multiple observations for one individual but you can also come up with other ways (you can also keep multiple observations of the same variables such as health1, health2 and use all of them in the matching). The goal is to have a dataset with one observation per individual.

*Using this dataset, perform the matching procedure with psmatch2. 

*Merge the information about the matched cases with the original dataset. Drop cases that are not matched etc. I am not sure about the details here because I don't really know stata and psmatch2 but I think you get the idea. 
Using these steps, you can match cases based on all pre-treatment information and you only have one match per treatment unit.
A: Steps:  


*

*As it has been mentioned in detail by Greg, you can use a cross-sectional dataset, either on pre-treatment means or on a sepecific pre-treatment period to generate the matching.

*Using the whole panel you assign indicator variables for
a. treatedIndividual
b. treatedPeriod, the latter is equal to zero as soon as the treatment occurs for the treatedIndividual. 
Since the point in time where treatedPeriod changes from 0 to 1 varies across individuals and never turns to 1 for untreated you must assign the same starting point from the treated match to the untreated match. This is intuitive but I would still like to see a good reference that justifies this approach which I have not found so far. 
The regression set-up would be:  
depvar = treatedIndvidual + treatedPeriod  + treatedIndvidual*treatedPeriod + controls

where the interaction term gives you the treatment effect.
A: Did you consider to use the nnmatch command?
I use this command and it is a pretty comprehensive one.
It does take into account different matching algorithms and also cases, in which the propensity score is the same for some control group individuals. Of course, the treatment of this case depends on the matching algorithm, if you take k-nearest-neighbour or kernel or whatever.
