{smcl}
{* 13Apr2006}{...}
{hline}
help for {hi:pairdata}
{hline}

{title:Create paired datasets from individual-per-row data}

    Basic syntax:

{p 8 21 2}{cmd:pairdata} {it:varlist} [{cmd:if} {it:exp}]{cmd:,} {cmdab:ind:ividual(}{it:varname}{cmd:)} {cmdab:fam:ily(}{it:varname}{cmd:)} [{cmdab:con:stant(}{it:varlist}{cmd:)}]


{title:Description}

{p 4 4 2}
{cmd:pairdata} converts individual-per-row data to single and double-entered paired data.


{center:         (original)           }


{center:fam	ind	var     cons}
{center:{hline 31}}
{center: 1  	1	44	P}
{center: 1  	2	45	P}
{center: 1  	3	46	P}
{center: 2  	1	47	Q}
{center: 2  	2	48	Q}



{center:         (single)           }


{center:fam	cons	ind_1	ind_2	var1_1	var1_2}
{center:{hline 51}}
{center: 1	P	1	2	44	45}
{center: 1	P	1	3	44	46}
{center: 1	P	2	3	45	46}
{center: 2	Q	1	2	47	48}



{center:         (double)           }

{center:fam	cons	ind_1	ind_2	var1_1	var1_2}
{center:{hline 51}}
{center: 1	P	1	2	44	45}
{center: 1	P	1	3	44	46}
{center: 1	P	2	3	45	46}
{center: 1	P	2	1	45	44}
{center: 1	P	3	1	46	44}
{center: 1	P	3	2	46	45}
{center: 2	Q	1	2	47	48}
{center: 2	Q	2	1	48	47}


{p 4 4 2}
{cmd:pairdata} creates three paired datasets based on pair combinations within familyID:

{p 8 12} double.dta: double entered file with all possible pair combinations {p_end}
{p 8 12} single.dta: single entered file with unique pair combinations {p_end}
{p 8 12} singlerand.dta: single entered file with unique pair combinations controlling for any type of order effect {p_end}



{p 4 4 2}
{cmd:pairdata} also generates two new variables for each of the three files:


{p 8 12} famcount: the number of members in each family. {p_end}
{p 8 12} nsibpair: a count of the number of pairs formed from each family. {p_end}



{title:Required Options}

{p 4 8 2}
{cmdab:ind:ividual(}{it:varname}{cmd:)} Specify individualID variable, this must be numeric and unique within familyID.

{p 4 8 2}
{cmdab:fam:ily(}{it:varname}{cmd:)} Specify familyID variable, this must be numeric and unique between families.


{title:Other Option}

{p 4 8 2}
{cmdab:con:stant(}{it:varname}{cmd:)} Specify constant variables, i.e. family specific variables. 


{title:Examples}

{cmd:. pairdata var1 var2, ind(individualID) fam(familyID)}
{cmd:. pairdata var1-var2, ind(individualid) fam(familyid) con(famtype)}


{title:Author}

{p 8 12}Richard J Williamson. {p_end}
{p 8 12}Social Genetic Developmental Psychiatry Research Centre, {p_end}
{p 8 12}Institute of Psychiatry, {p_end}
{p 8 12}Kings College London. {p_end}
{p 8 12}U.K. {p_end}
{p 8 12}richard.williamson@iop.kcl.ac.uk {p_end}



