Suppose you have a logit model where you are trying to estimate the
number of children a couple will have. Let's say there are 3 couples, 1,
2 and 3.
In my dataset, for each couple, I have several records which track, year
by year, if they have had a child, and if so, when and the sex of the
child. I want to collapse these separate records into one horizontal
record tracking the couple. Can anyone point me to some stata code that
might assist me?
[...]
It all depends on what you want to do. You can -reshape- (wide), but even
then there are several options. You can reshape any yearly information you
want by years (that is, j(year) ), but that may give you a very wide
dataset (giving you e.g., birth1980, birth1981, etc.) A more concise
scheme might be to reshape it into as many births as there are (birth1,
birth2, etc. -- keeping whatever information about these births as is
relevant).