Thanks to Kit Baum, my little utility dyadid.ado is available on SSC.
The utility provides a lightweight way to create dyadic data where individual records in a data set can be linked to specific other records. A typical case would be creating spouse-pair dyads in data containing individual records grouped in households.
If id is the individual identifier, and spid is the ID of the individual's spouse, the following code will access the spouse's age and income:
It does nothing that you can't do by renaming and merging, but it is more convenient. See my blog for a discussion.
The utility provides a lightweight way to create dyadic data where individual records in a data set can be linked to specific other records. A typical case would be creating spouse-pair dyads in data containing individual records grouped in households.
If id is the individual identifier, and spid is the ID of the individual's spouse, the following code will access the spouse's age and income:
Code:
. dyadid id spid, gen(idx) . gen spage = age[idx] . gen spinc = inc[idx]
Comment