Create paired datasets from individual-per-row data
Basic syntax:
pairdata varlist [if exp], individual(varname) family(varname) [constant(varlist)]
Description
pairdata converts individual-per-row data to single and double-entered paired data.
(original)
fam ind var cons ------------------------------- 1 1 44 P 1 2 45 P 1 3 46 P 2 1 47 Q 2 2 48 Q
(single)
fam cons ind_1 ind_2 var1_1 var1_2 --------------------------------------------------- 1 P 1 2 44 45 1 P 1 3 44 46 1 P 2 3 45 46 2 Q 1 2 47 48
(double)
fam cons ind_1 ind_2 var1_1 var1_2 --------------------------------------------------- 1 P 1 2 44 45 1 P 1 3 44 46 1 P 2 3 45 46 1 P 2 1 45 44 1 P 3 1 46 44 1 P 3 2 46 45 2 Q 1 2 47 48 2 Q 2 1 48 47
pairdata creates three paired datasets based on pair combinations within familyID:
double.dta: double entered file with all possible pair combinations single.dta: single entered file with unique pair combinations singlerand.dta: single entered file with unique pair combinations controlling for any type of order effect
pairdata also generates two new variables for each of the three files:
famcount: the number of members in each family. nsibpair: a count of the number of pairs formed from each family.
Required Options
individual(varname) Specify individualID variable, this must be numeric and unique within familyID.
family(varname) Specify familyID variable, this must be numeric and unique between families.
Other Option
constant(varname) Specify constant variables, i.e. family specific variables.
Examples
. pairdata var1 var2, ind(individualID) fam(familyID) . pairdata var1-var2, ind(individualid) fam(familyid) con(famtype)
Author
Richard J Williamson. Social Genetic Developmental Psychiatry Research Centre, Institute of Psychiatry, Kings College London. U.K. richard.williamson@iop.kcl.ac.uk