TEDS Data Dictionary

Derived Variables in the 12 Year Dataset

This page gives a listing of derived variables in the 12 Year dataset, in alphabetical order of variable name. For each variable, a short written description is followed by the SPSS syntax (in a box) that was used to derive the variable.

This page does not include descriptions of background variables that are derived from other sources and that are included in the 12 Year dataset. For information about such variables, see pages describing background variables, exclusions and scrambled IDs.

List of variables described on this page

Click on a variable name in the table below to go to the description on this page. Alternatively, scroll down and find variables in alphabetical order.

Definitions of derived variables

Listed alphabetically

larcort1/2, larinct1/2, lartot1/2

Scores for the twin Author Recognition web test:
larcort is the number of correct authors selected (0-21);
larinct is the number of incorrect authors selected (0-21);
lartot is the overall total score, derived by subtracting the number of incorrect responses from the number of correct responses. There were 21 correct authors and 21 incorrect authors to choose from, so in theory this score could vary from -21 to +21. Each item (author) response is coded 1=selected, 0=not selected.

* Derive sums of correct and incorrect responses.
COMPUTE larcort1 = SUM(lar01an1, lar02an1, lar05an1, lar06an1, lar10an1,
 lar12an1, lar13an1, lar14an1, lar15an1, lar16an1, lar19an1, lar22an1, lar23an1,
 lar24an1, lar26an1, lar28an1, lar31an1, lar34an1, lar35an1, lar37an1, lar39an1).
COMPUTE larinct1 = SUM(lar03an1, lar04an1, lar07an1, lar08an1, lar09an1, lar11an1, lar17an1,
 lar18an1, lar20an1, lar21an1, lar25an1, lar27an1, lar29an1, lar30an1,
 lar32an1, lar33an1, lar36an1, lar38an1, lar40an1, lar41an1, lar42an1).
EXECUTE.
* The preferred total score is the number of correct responses minus the number of incorrect responses.
COMPUTE lartot1 = larcort1 - larinct1.
EXECUTE.
lbat1tm1/2, lbat2tm1/2

Total time, in minutes, to finish the first battery (lbat1tm1/2) and second battery (lbat2tm1/2) of twin web tests.
Note that the first and second batteries included different tests for the AB and BA family groups.
Computed as lbat1tm1 and lbat2tm1 in the syntax below, then copied into variable lbat1tm2 and lbat2tm2 on double entry.

* Total time (minutes) for first and second batteries, if finished.
* Note the two batteries include different tests.
* for AB and BA battery groups.
DO IF (lbattery = 1).
  COMPUTE lbat1tm1 = (1/60) * SUM.8(leytime1,lhstime1,ljgtime1,lqntime1,
  		lpitime1,lgotime1,lyntime1,lmatime1).
  COMPUTE lbat2tm1 = (1/60) * SUM.7(lrvtime1,lgktime1,lvctime1,lpctime1,
  		lfltime1,lintime1,ltotime1).
ELSE IF (lbattery = 2).
  COMPUTE lbat1tm1 = (1/60) * SUM.11(leytime1,lhstime1,ljgtime1,lqntime1,
  		lrvtime1,lgktime1,lvctime1,lpctime1,lfltime1,lintime1,ltotime1).
  COMPUTE lbat2tm1 = (1/60) * SUM.4(lpitime1,lgotime1,lyntime1,lmatime1).
END IF.
EXECUTE.
lbmi1/2

Twin BMI (body mass index) measurements, in units of kilograms per square metre.
Derived from twin height and weight item variables, from the twin booklet.
Computed as lbmi1 in the syntax below, then copied into variable lbmi2 on double entry.

* Dataset height variables (from twin booklet) are in centimetres.
* We want BMI in units of kilograms per square metre.
* So include a scaling factor of 10000 in the BMI calculation.
* and round result to nearest 0.1.
COMPUTE lbmi1 = RND(((10000 * lcwtkg1) / (lchtcm1 * lchtcm1)), 0.1).
EXECUTE.
lcchato1/2, lpchatot

Chaos scales.
Parent (lpchatot) and child (lcchato1/2) versions derived from Chaos items in the booklets.
Child version computed as lcchato1 in the syntax below, then copied into variable lcchato2 on double entry.

* Based on parent-reported and child self-reported items in the questionnaires.
* As usual, require at least half the items to be non-missing.
* Parent-reported (per-family) and child self-reproted (per-twin) versions.
* Note that the parent chaos only has 5 items whereas the child chaos has 6 items.
COMPUTE lpchatot = 5 * MEAN.3(lpchaos1r, lpchaos2, lpchaos3r, lpchaos4, lpchaos5r).
COMPUTE lcchato1 = 6 * MEAN.3(lccha1r1, lccha21, lccha31,
 lccha4r1, lccha51, lccha6r1).
EXECUTE .
lcdisavot1/2, lcdisnegt1/2, lcdispost1/2, lpdisavot1/2, lpdisnegt1/2, lpdispost1/2

Parental Discipline subscales.
Parent (lp) and child (lc) versions derived from the 6 Parental Discipline items in the booklets. Subscales for negative/harsh (disnegt), positive (dispost) and avoidance (disavot). Each subscale is derived from 2 items and each item has values 0/1/2, hence each subscale has values ranging from 0 to 4.

* Parental Discipline.
* Parent-reported and child self-reported versions.
* Negative/harsh discipline: 2 items.
COMPUTE lpdisnegt1 = 2 * MEAN.1(lpdis011, lpdis021).
COMPUTE lcdisnegt1 = 2 * MEAN.1(lcdis11, lcdis21).
* Positive discipline: 2 items.
COMPUTE lpdispost1 = 2 * MEAN.1(lpdis031, lpdis041).
COMPUTE lcdispost1 = 2 * MEAN.1(lcdis31, lcdis41).
* Avoidance: 2 items.
COMPUTE lpdisavot1 = 2 * MEAN.1(lpdis051, lpdis061).
COMPUTE lcdisavot1 = 2 * MEAN.1(lcdis51, lcdis61).
EXECUTE.
lcg1/2, lcnv1/2, lcvb1/2

Cognitive ability scales for twins, based on web test scores.
Lcg1/2 represents general cognitive ability or 'g'. Lcnv1/2 represents non-verbal cognitive ability. Lcvb1/2 represents verbal (or language) cognitive ability.
Each scale is computed as the standardized mean of appropriate standardized web test scores. Standardization is carried out on a filtered sample in which all exclusions are removed.
Variables lvctota1/2, lgktota1/2 and lrvtota1/2 are the test scores adjusted for discontinued items (these are derived variables described elsewhere on this page). The picture completion test does not have an adjusted score, so the raw score lpctot1/2 is used.

* These are equally-weighted means of standardised scores.
* For web tests, use adjusted scores where available.
* First filter out all the standard twin exclusions.
* (medical, perinatal, unknown sex/zyg, missing 1st Contact).
* This will affect all standardised variables derived below.
USE ALL.
COMPUTE filter_$=(exclude1 = 0).
VARIABLE LABELS filter_$ 'exclude1 = 0 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

* First standardise the required component variables.
DESCRIPTIVES
  VARIABLES=lgktota1 lvctota1 lpctot1 lrvtota1 /SAVE .

* Cognitive ability composites.
* Derived from twin web test scores.
* Require all component items to be non-missing.
* Compute G as the mean of all 4 test scores.
COMPUTE g1 = MEAN.4(zlvctota1,zlgktota1,zlpctot1,zlrvtota1) .
EXECUTE .
* Compute verbal and non-verbal scales using 2 each of the scores.
COMPUTE vb1 = MEAN.2(zlvctota1,zlgktota1) .
COMPUTE nv1 = MEAN.2(zlpctot1,zlrvtota1) .
EXECUTE.

* standardise the new variables.
DESCRIPTIVES
  VARIABLES= g1 (lcg1) vb1 (lcvb1) nv1 (lcnv1) /SAVE .

* Standardisations finished - remove filter.
FILTER OFF.
USE ALL.
EXECUTE.
lcliaca1/2, lclieng1/2, lclimat1/2, lcliphy1/2, lclisci1/2, lcmoaca1/2, lcpaaca1/2, lcpaeng1/2, lcpamat1/2, lcpaphy1/2, lcpasci1/2

Motivational scales.
Derived from Motivational items (how good are you, how much do you like) in the twin booklet.
Computed as variables with names ending in 1 in the syntax below; later copied into co-twin variables with names ending in 2 on double entry.

* From self-report items in the child questionnaire.
* Liking scales computed from the 'how much do you like' items.
* Perceived ability scales from the 'how good are you' items.

* First get reverse-coded versions of all items.
* so that high scores indicate positive good/like.
* Recode into temporary variables, which will be dropped.
RECODE
  lcgoo011 lcgoo021 lcgoo031 lcgoo041 lcgoo051 lcgoo061 lcgoo071 lcgoo081
  lcgoo091 lcgoo101 lcgoo111 lcgoo121 lclik011 lclik021 lclik031 lclik041
  lclik051 lclik061 lclik071 lclik081 lclik091 lclik101 lclik111 lclik121
  (1=5) (2=4) (3=3) (4=2) (5=1) (SYSMIS=SYSMIS)
INTO
  cgoo011 cgoo021 cgoo031 cgoo041 cgoo051 cgoo061 cgoo071 cgoo081
  cgoo091 cgoo101 cgoo111 cgoo121 clik011 clik021 clik031 clik041
  clik051 clik061 clik071 clik081 clik091 clik101 clik111 clik121 .
EXECUTE. 

* English.
* items 1, 2 and 3.
COMPUTE lcpaeng1 = MEAN.2(cgoo011,cgoo021,cgoo031).
COMPUTE lclieng1 = MEAN.2(clik011,clik021,clik031).
EXECUTE.

* Maths.
* items 4, 5 and 6.
COMPUTE lcpamat1 = MEAN.2(cgoo041,cgoo051,cgoo061).
COMPUTE lclimat1 = MEAN.2(clik041,clik051,clik061).
EXECUTE.

* Science.
* items 7, 8 and 9.
COMPUTE lcpasci1 = MEAN.2(cgoo071,cgoo081,cgoo091).
COMPUTE lclisci1 = MEAN.2(clik071,clik081,clik091).
EXECUTE.

* Physical education.
* items 10, 11 and 12.
COMPUTE lcpaphy1 = MEAN.2(cgoo101,cgoo111,cgoo121).
COMPUTE lcliphy1 = MEAN.2(clik101,clik111,clik121).
EXECUTE.

* Overall academic.
* items 1 to 9.
COMPUTE lcpaaca1 = MEAN.6(cgoo011,cgoo021,cgoo031,cgoo041,cgoo051,
	cgoo061,cgoo071,cgoo081,cgoo091).
COMPUTE lcliaca1 = MEAN.6(clik011,clik021,clik031,clik041,clik051,
	clik061,clik071,clik081,clik091).
EXECUTE.
* add a mean of the 'good' and 'like' scales.
COMPUTE lcmoaca1 = MEAN.2(lcpaaca1,lcliaca1).
EXECUTE.
lcmfqt1/2, lpmfqt1/2, lcemfqt1/2, lpemfqt1/2

MFQ total scales.
The plain versions lcmfqt1/2 (child) and lpmfqt1/2 (parent) are derived from the 11 MFQ items only.
The enhanced versions lcemfqt1/2 (child) and lpemfqt1/2 (parent) are derived from the 11 MFQ items plus 2 SDQ items from the same booklets.

* MFQ scales.
* Require at least half the items to be present for each scale.
* Standard version: from the 11 MFQ items only (parent and child).
COMPUTE lpmfqt1 = 11 * MEAN.6(lpmd011, lpmd021, lpmd031, lpmd041, lpmd051,
 lpmd061, lpmd071, lpmd081, lpmd091, lpmd101, lpmd111).
COMPUTE lcmfqt1 = 11 * MEAN.6(lcmd011, lcmd021, lcmd031, lcmd041, lcmd051,
 lcmd061, lcmd071, lcmd081, lcmd091, lcmd101, lcmd111).
EXECUTE.
* Enhanced version: the 11 MFQ items are supplemented with 2 of the SDQ items.
COMPUTE lpemfqt1 = 13 * MEAN.7(lpmd011, lpmd021, lpmd031, lpmd041, lpmd051,
 lpmd061, lpmd071, lpmd081, lpmd091, lpmd101, lpmd111, lpsdqemo31, lpsdqhyp11).
COMPUTE lcemfqt1 = 13 * MEAN.7(lcmd011, lcmd021, lcmd031, lcmd041, lcmd051,
 lcmd061, lcmd071, lcmd081, lcmd091, lcmd101, lcmd111, lcsdqemo31, lcsdqhyp11).
 EXECUTE.
lcnv1/2

See lcg1/2, lcnv1/2, lcvb1/2 above.

lcpaaca1/2, lcpaeng1/2, lcpamat1/2, lcpaphy1/2, lcpasci1/2

See lcliaca1/2, etc above.

lcparnegt1/2, lcparpost1/2, lcpart1/2, lpparnegt1/2, lpparpost1/2, lppart1/2

Parental Feelings scales.
Parent (lp) and child (lc) versions derived from the 7 Parental Feelings items in the booklets.
Negative feelings subscale (parnegt), positive feelings subscale (parpost) and overall total scale (part). The overall total scale is coded in the direction of negative feelings, so for this scale the positive feelings items are reversed.

* Parental Feelings.
* Parent-reported and child self-reported versions.
* Negative feelings: 4 items.
COMPUTE lpparnegt1 = 4 * MEAN.2(lppar011, lppar041, lppar051, lppar071).
COMPUTE lcparnegt1 = 4 * MEAN.2(lcdis11, lcpar41, lcpar51, lcpar71).
* Positive feelings: 3 items.
COMPUTE lpparpost1 = 3 * MEAN.2(lppar021, lppar031, lppar061).
COMPUTE lcparpost1 = 3 * MEAN.2(lcpar21, lcpar31, lcpar61).
* Total scale: all 7 items, coded in the negative feelings direction.
* so use the reversed versions of the positive feelings items.
COMPUTE lppart1 =  7 * MEAN.4(lppar011, lppar02r1,
  lppar03r1, lppar041, lppar051, lppar06r1, lppar071). 
COMPUTE lcpart1 =  7 * MEAN.4(lcpar11, lcpar2r1,
  lcpar3r1, lcpar41, lcpar51, lcpar6r1, lcpar71). 
EXECUTE. 
lcpub5age1/2

Age, derived as an integer number of years, of reported onset of menstruation. Derived from raw item variables reporting the year (lcpub5y) and month (lcpub5m) of onsent of menstruation and from the twin birth date (aonsdob). These raw date variables are not retained in the dataset for reasons of potential identifiability. Ages below 9 years were very rare, so value 9 is used to code for 9 years or less.

* Derive age of onset of menstruation, to replace raw year/month variables.
* and to avoid date variables that might aid identifiability.
* Get year and month of twin birth.
COMPUTE aonsby = XDATE.YEAR(aonsdob).
COMPUTE aonsbm = XDATE.MONTH(aonsdob).
EXECUTE.
* Now derive age in months, based on year and month of twin birth.
* If menstruation onset month is missing, just use the year.
IF (SYSMIS(lcpub5m1)) lcpub5months = (lcpub5y1 - aonsby) * 12.
EXECUTE.
* otherwise include months in calculation.
IF (~SYSMIS(lcpub5m1)) lcpub5months = (12 * (lcpub5y1 - aonsby)) + (lcpub5m1 - aonsbm).
EXECUTE.
* Now recode age in months into ordinal age groups based on years.
* after inspecting the distribution: 9 or less, 10, 11, 12.
* (age 13 does not occur in this dataset).
RECODE lcpub5months (LOWEST THRU 119=9) (120 THRU 131=10)
 (132 THRU 143=11) (144 THRU HIGHEST=12)
INTO lcpub5age1.
EXECUTE.
lcqage1/2

Age of twin (in decimal years) when the twin booklet was returned.
Derived from the return date of the child booklet (lcrdate1/2) and the birth date of the twins (aonsdob). These date variables are not retained in the dataset.

* Age when child questionnaires returned.
COMPUTE lcqage1 = RND((DATEDIFF(lcrdate1, aonsdob, "days")) / 365.25, 0.1).
EXECUTE.
lcqLLCage1/2, lcqLLCdate1/2, lctwLLCage1/2, lctwLLCdate1/2, lcwLLCage1/2, lcwLLCdate1/2, lpncLLCage, lpncLLCdate, lpqLLCage, lpqLLCdate, ltqLLCage1/2, ltqLLCdate1/2

Age and date variables derived for use in datasets in the LLC TRE (but not to be used in other datasets).
Ages and dates are derived for the parent questionnaire ('lpq'), the child questionnaire ('lcq'), the child web activities ('lcw'), the twin TOWRE phone test ('lctw'), the teacher questionnaire ('ltq'), and the return of the parent-reported twin NC levels ('lpnc').
The LLC date variables contain only the month and year, not the day, as a means of reducing identifiability. The date variables are strings formatted as 'yyyy-mm'. These LLC dates are designed to enable the TEDS measures to be placed in a time sequence with NHS medical diagnosis dates in the data in the TRE.
The LLC age variables are integers measuring the number of months between birth and the given TEDS activity, consistent with the matching LLC date variables.
Variable aonsdob is the twin birth date - the raw date variables are not retained in the dataset.

* First extract year and month as temp variables, from birth date and activity dates.
COMPUTE birthyear = XDATE.YEAR(aonsdob).
COMPUTE birthmonth = XDATE.MONTH(aonsdob).
COMPUTE lpqyear = XDATE.YEAR(lpqdate).
COMPUTE lpqmonth = XDATE.MONTH(lpqdate).
COMPUTE lpncyear = XDATE.YEAR(lpncdate).
COMPUTE lpncmonth = XDATE.MONTH(lpncdate).
COMPUTE ltqyear1 = XDATE.YEAR(ltrdate1).
COMPUTE ltqmonth1 = XDATE.MONTH(ltrdate1).
COMPUTE lcqyear1 = XDATE.YEAR(lcrdate1).
COMPUTE lcqmonth1 = XDATE.MONTH(lcrdate1).
COMPUTE lcwyear1 = XDATE.YEAR(lcwdate1).
COMPUTE lcwmonth1 = XDATE.MONTH(lcwdate1).
COMPUTE lctwyear1 = XDATE.YEAR(ltwdate1).
COMPUTE lctwmonth1 = XDATE.MONTH(ltwdate1).
EXECUTE.

* The agreed LLC date format is a string yyyy-mm (nominal by default for strings).
* adding '0' where necessary for two-digit months.
STRING lpqLLCdate lpncLLCdate ltqLLCdate1 lcwLLCdate1 lcqLLCdate1 lctwLLCdate1 (A7).
IF (lpqmonth < 10) lpqLLCdate = CONCAT(STRING(lpqyear, F4), '-0', STRING(lpqmonth, F1)).
IF (lpqmonth >= 10) lpqLLCdate = CONCAT(STRING(lpqyear, F4), '-', STRING(lpqmonth, F2)).
IF (lpncmonth < 10) lpncLLCdate = CONCAT(STRING(lpncyear, F4), '-0', STRING(lpncmonth, F1)).
IF (lpncmonth >= 10) lpncLLCdate = CONCAT(STRING(lpncyear, F4), '-', STRING(lpncmonth, F2)).
IF (lcqmonth1 < 10) lcqLLCdate1 = CONCAT(STRING(lcqyear1, F4), '-0', STRING(lcqmonth1, F1)).
IF (lcqmonth1 >= 10) lcqLLCdate1 = CONCAT(STRING(lcqyear1, F4), '-', STRING(lcqmonth1, F2)).
IF (ltqmonth1 < 10) ltqLLCdate1 = CONCAT(STRING(ltqyear1, F4), '-0', STRING(ltqmonth1, F1)).
IF (ltqmonth1 >= 10) ltqLLCdate1 = CONCAT(STRING(ltqyear1, F4), '-', STRING(ltqmonth1, F2)).
IF (lcwmonth1 < 10) lcwLLCdate1 = CONCAT(STRING(lcwyear1, F4), '-0', STRING(lcwmonth1, F1)).
IF (lcwmonth1 >= 10) lcwLLCdate1 = CONCAT(STRING(lcwyear1, F4), '-', STRING(lcwmonth1, F2)).
IF (lctwmonth1 < 10) lctwLLCdate1 = CONCAT(STRING(lctwyear1, F4), '-0', STRING(lctwmonth1, F1)).
IF (lctwmonth1 >= 10) lctwLLCdate1 = CONCAT(STRING(lctwyear1, F4), '-', STRING(lctwmonth1, F2)).
EXECUTE.

* The agreed LLC age variable is in integer months.
* and it must agree with the birth and booklet year/month variables that will be available in the LLC.
COMPUTE lpqLLCage = (lpqmonth + (lpqyear * 12)) - (birthmonth + (birthyear * 12)).
COMPUTE lpncLLCage = (lpncmonth + (lpncyear * 12)) - (birthmonth + (birthyear * 12)).
COMPUTE lcqLLCage1 = (lcqmonth1 + (lcqyear1 * 12)) - (birthmonth + (birthyear * 12)).
COMPUTE ltqLLCage1 = (ltqmonth1 + (ltqyear1 * 12)) - (birthmonth + (birthyear * 12)).
COMPUTE lcwLLCage1 = (lcwmonth1 + (lcwyear1 * 12)) - (birthmonth + (birthyear * 12)).
COMPUTE lctwLLCage1 = (lctwmonth1 + (lctwyear1 * 12)) - (birthmonth + (birthyear * 12)).
EXECUTE.
lcsdqbeht1/2, lpsdqbeht1/2, ltsdqbeht1/2

SDQ Total Problem Behaviours scales.
Parent (lp), child (lc) and teacher (lt) versions.
Total scores with range 0-40.
Each is derived from 20 SDQ items, requiring at least 10 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* SDQ Total Behaviour Problems: all except the Prosocial items.
COMPUTE lpsdqbeht1 = 20 * MEAN.10(lpsdqhyp11, lpsdqhyp21, lpsdqhyp31, lpsdqhyp4r1, lpsdqhyp5r1, 
  lpsdqcon11, lpsdqcon2r1, lpsdqcon31, lpsdqcon41, lpsdqcon51, 
  lpsdqper11, lpsdqper2r1, lpsdqper3r1, lpsdqper41, lpsdqper51, 
  lpsdqemo11, lpsdqemo21, lpsdqemo31, lpsdqemo41, lpsdqemo51).
COMPUTE ltsdqbeht1 = 20 * MEAN.10(ltsdqhyp11, ltsdqhyp21, ltsdqhyp31, ltsdqhyp4r1, ltsdqhyp5r1, 
  ltsdqcon11, ltsdqcon2r1, ltsdqcon31, ltsdqcon41, ltsdqcon51, 
  ltsdqper11, ltsdqper2r1, ltsdqper3r1, ltsdqper41, ltsdqper51, 
  ltsdqemo11, ltsdqemo21, ltsdqemo31, ltsdqemo41, ltsdqemo51).
COMPUTE lcsdqbeht1 = 20 * MEAN.10(lcsdqhyp11, lcsdqhyp21, lcsdqhyp31, lcsdqhyp4r1, lcsdqhyp5r1, 
  lcsdqcon11, lcsdqcon2r1, lcsdqcon31, lcsdqcon41, lcsdqcon51, 
  lcsdqper11, lcsdqper2r1, lcsdqper3r1, lcsdqper41, lcsdqper51, 
  lcsdqemo11, lcsdqemo21, lcsdqemo31, lcsdqemo41, lcsdqemo51).
EXECUTE.
lcsdqcont1/2, lpsdqcont1/2, ltsdqcont1/2

SDQ Conduct scales.
Parent (lp), child (lc) and teacher (lt) versions.
Total scores with range 0-10.
Each is derived from 5 SDQ items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

COMPUTE lpsdqcont1 = 5 * MEAN.3(lpsdqcon11, lpsdqcon2r1, lpsdqcon31, lpsdqcon41, lpsdqcon51).
COMPUTE ltsdqcont1 = 5 * MEAN.3(ltsdqcon11, ltsdqcon2r1, ltsdqcon31, ltsdqcon41, ltsdqcon51).
COMPUTE lcsdqcont1 = 5 * MEAN.3(lcsdqcon11, lcsdqcon2r1, lcsdqcon31, lcsdqcon41, lcsdqcon51).
EXECUTE.
lcsdqemot1/2, lpsdqemot1/2, ltsdqemot1/2

SDQ Emotional symptoms scales (previously called Anxiety).
Parent (lp), child (lc) and teacher (lt) versions.
Total scores with range 0-10.
Each is derived from 5 SDQ items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* Emotion scales (previously referred to as Anxiety).
COMPUTE lpsdqemot1 = 5 * MEAN.3(lpsdqemo11, lpsdqemo21, lpsdqemo31, lpsdqemo41, lpsdqemo51).
COMPUTE ltsdqemot1 = 5 * MEAN.3(ltsdqemo11, ltsdqemo21, ltsdqemo31, ltsdqemo41, ltsdqemo51).
COMPUTE lcsdqemot1 = 5 * MEAN.3(lcsdqemo11, lcsdqemo21, lcsdqemo31, lcsdqemo41, lcsdqemo51).
EXECUTE.
lcsdqhypt1/2, lpsdqhypt1/2, ltsdqhypt1/2

SDQ Hyperactivity scales.
Parent (lp), child (lc) and teacher (lt) versions.
Total scores with range 0-10.
Each is derived from 5 SDQ items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

COMPUTE lpsdqhypt1 = 5 * MEAN.3(lpsdqhyp11, lpsdqhyp21, lpsdqhyp31, lpsdqhyp4r1, lpsdqhyp5r1).
COMPUTE ltsdqhypt1 = 5 * MEAN.3(ltsdqhyp11, ltsdqhyp21, ltsdqhyp31, ltsdqhyp4r1, ltsdqhyp5r1).
COMPUTE lcsdqhypt1 = 5 * MEAN.3(lcsdqhyp11, lcsdqhyp21, lcsdqhyp31, lcsdqhyp4r1, lcsdqhyp5r1).
EXECUTE.
lcsdqpert1/2, lpsdqpert1/2, ltsdqpert1/2

SDQ Peer Problems scales.
Parent (lp), child (lc) and teacher (lt) versions.
Total scores with range 0-10.
Each is derived from 5 SDQ items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

COMPUTE lpsdqpert1 = 5 * MEAN.3(lpsdqper11, lpsdqper2r1, lpsdqper3r1, lpsdqper41, lpsdqper51).
COMPUTE ltsdqpert1 = 5 * MEAN.3(ltsdqper11, ltsdqper2r1, ltsdqper3r1, ltsdqper41, ltsdqper51).
COMPUTE lcsdqpert1 = 5 * MEAN.3(lcsdqper11, lcsdqper2r1, lcsdqper3r1, lcsdqper41, lcsdqper51).
EXECUTE.
lcsdqprot1/2, lpsdqprot1/2, ltsdqprot1/2

SDQ Prosocial scales.
Parent (lp), child (lc) and teacher (lt) versions.
Total scores with range 0-10.
Each is derived from 5 SDQ items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

COMPUTE lpsdqprot1 = 5 * MEAN.3(lpsdqpro11, lpsdqpro21, lpsdqpro31, lpsdqpro41, lpsdqpro51).
COMPUTE ltsdqprot1 = 5 * MEAN.3(ltsdqpro11, ltsdqpro21, ltsdqpro31, ltsdqpro41, ltsdqpro51).
COMPUTE lcsdqprot1 = 5 * MEAN.3(lcsdqpro11, lcsdqpro21, lcsdqpro31, lcsdqpro41, lcsdqpro51).
EXECUTE.
lctwage1/2

Age of twin (in decimal years) when the TOWRE telephone test results were logged as returned by the caller.
Derived from the return date (ltwdate1/2) and the birth date of the twins (aonsdob). These date variables are not retained in the dataset.

* Age when TOWRE test results were logged in.
COMPUTE lctwage1 = RND((DATEDIFF(ltwdate1, aonsdob, "days")) / 365.25, 0.1).
EXECUTE.
lctwLLCage1/2, lctwLLCdate1/2

See lcqLLCage1/2, etc above.

lcvb1/2

See lcg1/2, lcnv1/2, lcvb1/2 above.

lcvicph1/2, lcvicpr1/2, lcvicso1/2, lcvicve1/2

Victimization scales.
Derived from Victimization items in the twin booklet.
Computed as variables with names ending in 1 in the syntax below; later copied into co-twin variables with names ending in 2 on double entry.

* From self-report items of the Victimization measure in the child questionnaire.
* Each scale is derived from 4 of the 16 items.
* Each item has values 0/1/2, so each scale has a range of values.
* from 0 to 8 and is effectively a total score.

* Physical, Verbal, Social Manipulation, and Property scales.
COMPUTE lcvicph1 = 4 * MEAN.2(lcvic011, lcvic051, lcvic091, lcvic131).
COMPUTE lcvicve1 = 4 * MEAN.2(lcvic031, lcvic071, lcvic111, lcvic151).
COMPUTE lcvicso1 = 4 * MEAN.2(lcvic021, lcvic061, lcvic101, lcvic141).
COMPUTE lcvicpr1 = 4 * MEAN.2(lcvic041, lcvic081, lcvic121, lcvic161).
EXECUTE.
lcwage1/2

Age of twin (in decimal years) when the web tests were started.
Derived from the start date of the first web test (usually either Eyes or PIAT); and the birth date of the twins (aonsdob). These date variables are not retained in the dataset.

* Twin web test start date: this was the start of the Eyes test in 2006 and 2007.
COMPUTE lcwdate1 = leystdt1.
EXECUTE.
* For 2008 top-up tests, Piat was the first test: use this if Eyes missing.
IF (SYSMIS(leystdt1)) lcwdate1 = lpistdt1.
EXECUTE.
* Still a few missing - use date of Yes/No test.
IF (SYSMIS(leystdt1) & SYSMIS(lpistdt1)) lcwdate1 = lynstdt1.
EXECUTE.
* Note that, for twins who started tests in 2006/07 but finished some tests in 2008.
* the start date may give a slightly misleading age for the 4 repeated tests (if finished).
* However, few cases are affected by this (a few hundred).
* and even then the age is only a year or so wrong, and this only for the 4 tests.
* Also, the age is correct if no tests were done in 2006/07 but were done in 2008.
* because then the 2008 PIAT date will have been used.
* Now subtract birth date from web start date to find age.
COMPUTE lcwage1 = RND((DATEDIFF(lcwdate1, aonsdob, "days")) / 365.25, 0.1).
EXECUTE.
lcwdata1/2

Data flag to show the presence or absence of twin web data (1=yes, 0=no).
Computed from item variables which flag the presence of data for the individual web tests.

* determine which twins have web data (from any test).
COMPUTE lcwdata1 = 0.
EXECUTE.
IF (SUM(leydata1, lhsdata1, ljgdata1, lqndata1, lardata1, lpidata1,
 lgodata1, lyndata1, lmadata1, lgkdata1, lvcdata1, lpcdata1, lrvdata1,
 lfldata1, lindata1, ltodata1) > 0) lcwdata1 = 1.
EXECUTE.
lcwLLCage1/2, lcwLLCdate1/2

See lcqLLCage1/2, etc above.

lestcon1/2

Estimated internet connection type for each twin attempting the web tests.
Categories are 1=broadband, 2=dialup, 3=indeterminate, 0=unknown.
Categorisation is based on web test mean item download times from the two tests (PIAT and General Knowledge) that show bimodal distributions thought to originate from slow and fast connections. Note that download times (both for items and means) are not retained as dataset variables.

* Estimated internet connection type.
* Based on mean download times from PIAT and General Knowledge tests.
* because investigation showed the these have bimodal distributions.
* suggestive of broadband and dial-up modes.
* Derive these two mean download times first, as temporary variables.
COMPUTE lpidtm1 = MEAN(lpip3dt1, lpip4dt1, lpip5dt1,
 lpi19dt1, lpi20dt1, lpi21dt1, lpi22dt1, lpi23dt1, lpi24dt1,
 lpi25dt1, lpi26dt1, lpi27dt1, lpi28dt1, lpi29dt1, lpi30dt1, lpi31dt1, lpi32dt1,
 lpi33dt1, lpi34dt1, lpi35dt1, lpi36dt1, lpi37dt1, lpi38dt1, lpi39dt1, lpi40dt1,
 lpi41dt1, lpi42dt1, lpi43dt1, lpi44dt1, lpi45dt1, lpi46dt1, lpi47dt1, lpi48dt1,
 lpi49dt1, lpi50dt1, lpi51dt1, lpi52dt1, lpi53dt1, lpi54dt1, lpi55dt1, lpi56dt1,
 lpi57dt1, lpi58dt1, lpi59dt1, lpi60dt1, lpi61dt1, lpi62dt1, lpi63dt1, lpi64dt1,
 lpi65dt1, lpi66dt1, lpi67dt1, lpi68dt1, lpi69dt1, lpi70dt1, lpi71dt1, lpi72dt1,
 lpi73dt1, lpi74dt1, lpi75dt1, lpi76dt1, lpi77dt1, lpi78dt1, lpi79dt1, lpi80dt1,
 lpi81dt1, lpi82dt1, lpi83dt1, lpi84dt1, lpi85dt1, lpi86dt1, lpi87dt1, lpi88dt1,
 lpi89dt1, lpi90dt1, lpi91dt1, lpi92dt1, lpi93dt1, lpi94dt1, lpi95dt1, lpi96dt1,
 lpi97dt1, lpi98dt1, lpi99dt1, lpi100dt1).
COMPUTE lgkdtm1 = MEAN(lgk01dt1, lgk02dt1, lgk03dt1, lgk04dt1, lgk05dt1,
 lgk06dt1, lgk07dt1, lgk08dt1, lgk09dt1, lgk10dt1, lgk11dt1, lgk12dt1,
 lgk13dt1, lgk14dt1, lgk15dt1, lgk16dt1, lgk17dt1, lgk18dt1, lgk19dt1,
 lgk20dt1, lgk21dt1, lgk22dt1, lgk23dt1, lgk24dt1, lgk25dt1, lgk26dt1,
 lgk27dt1, lgk28dt1, lgk29dt1, lgk30dt1).
EXECUTE.
* Now derive a mean from the two tests.
COMPUTE lpigkdt1 = MEAN.1(lpidtm1, lgkdtm1).
EXECUTE.
* For supposedly broadband families, distribution is unimodal.
* with most in the range 0 to 5 seconds but gradually tailing off.
* For supposedly dial-up families, distribution from 0 to 6 seconds.
* is roughly the same as for the broadband families.
* so assume that these cases actually used broadband computers.
* Others over 10 seconds have a 2nd mode in the distribution.
* so assume these are genuine dial-ups.
* Cases between 6 and 10 are difficult to classify.
* Hence classify broadband and dial-up using 6 and 10 second cut-offs.
* regardless of parent responses about their connection type.
COMPUTE lestcon1 = 0.
EXECUTE.
IF (lpigkdt1 > 6 & lpigkdt1 < 10) lestcon1 = 3.
IF (lpigkdt1 <= 6) lestcon1 = 1.
IF (lpigkdt1 >= 10) lestcon1 = 2.
EXECUTE.
leyatm1/2

Mean item answer time (in seconds) for the twin Eyes web test.
Computed as leyatm1 in the syntax below, and later copied to variable leyatm2 on double entry.

COMPUTE leyatm1 = MEAN(ley01at1,ley02at1,ley03at1,ley04at1,
 ley05at1,ley06at1,ley07at1,ley08at1,
 ley09at1,ley10at1,ley11at1,ley12at1,ley13at1,ley14at1,ley15at1,ley16at1,
 ley17at1,ley18at1,ley19at1,ley20at1,ley21at1,ley22at1,ley23at1,ley24at1,
 ley25at1,ley26at1,ley27at1,ley28at1).
lflatm1/2

Mean item answer time (in seconds) for the twin Figurative Language web test.
Computed as lflatm1 in the syntax below, and later copied to variable lflatm2 on double entry.

COMPUTE lflatm1 = MEAN(lfl01at1,lfl02at1,lfl03at1,
 lfl04at1,lfl05at1,lfl06at1,lfl07at1,lfl08at1,
 lfl09at1,lfl10at1,lfl11at1).
lgkatm1/2

Mean item answer time (in seconds) for the twin General Knowledge web test.
Computed as lgkatm1 in the syntax below, and later copied to variable lgkatm2 on double entry.

COMPUTE lgkatm1 = MEAN(lgk01at1,lgk02at1,lgk03at1,
 lgk04at1,lgk05at1,lgk06at1,lgk07at1,lgk08at1,
 lgk09at1,lgk10at1,lgk11at1,lgk12at1,lgk13at1,lgk14at1,lgk15at1,lgk16at1,
 lgk17at1,lgk18at1,lgk19at1,lgk20at1,lgk21at1,lgk22at1,lgk23at1,lgk24at1,
 lgk25at1,lgk26at1,lgk27at1,lgk28at1,lgk29at1,lgk30at1).
lgktota1/2

Adjusted version of the total score for the General Knowledge web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, can discontinue from item 11 onwards.
* Copy existing item scores into temporary variables.
RECODE lgk11sc1 lgk12sc1 lgk13sc1 lgk14sc1 lgk15sc1 lgk16sc1 lgk17sc1 lgk18sc1
 lgk19sc1 lgk20sc1 lgk21sc1 lgk22sc1 lgk23sc1 lgk24sc1 lgk25sc1 lgk26sc1
 lgk27sc1 lgk28sc1 lgk29sc1 lgk30sc1 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lgk11sc1a lgk12sc1a lgk13sc1a lgk14sc1a lgk15sc1a lgk16sc1a lgk17sc1a lgk18sc1a
 lgk19sc1a lgk20sc1a lgk21sc1a lgk22sc1a lgk23sc1a lgk24sc1a lgk25sc1a lgk26sc1a
 lgk27sc1a lgk28sc1a lgk29sc1a lgk30sc1a.
EXECUTE.
* Where discontinued, replace score of 0 with score of 0.25.
* (each item has 4 possible responses, so chance score is 1/4).
IF (lgk11an1 = -2) lgk11sc1a = 0.25.
IF (lgk12an1 = -2) lgk12sc1a = 0.25.
IF (lgk13an1 = -2) lgk13sc1a = 0.25.
IF (lgk14an1 = -2) lgk14sc1a = 0.25.
IF (lgk15an1 = -2) lgk15sc1a = 0.25.
IF (lgk16an1 = -2) lgk16sc1a = 0.25.
IF (lgk17an1 = -2) lgk17sc1a = 0.25.
IF (lgk18an1 = -2) lgk18sc1a = 0.25.
IF (lgk19an1 = -2) lgk19sc1a = 0.25.
IF (lgk20an1 = -2) lgk20sc1a = 0.25.
IF (lgk21an1 = -2) lgk21sc1a = 0.25.
IF (lgk22an1 = -2) lgk22sc1a = 0.25.
IF (lgk23an1 = -2) lgk23sc1a = 0.25.
IF (lgk24an1 = -2) lgk24sc1a = 0.25.
IF (lgk25an1 = -2) lgk25sc1a = 0.25.
IF (lgk26an1 = -2) lgk26sc1a = 0.25.
IF (lgk27an1 = -2) lgk27sc1a = 0.25.
IF (lgk28an1 = -2) lgk28sc1a = 0.25.
IF (lgk29an1 = -2) lgk29sc1a = 0.25.
IF (lgk30an1 = -2) lgk30sc1a = 0.25.
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE lgktota1 = SUM(lgk01sc1, lgk02sc1, lgk03sc1, lgk04sc1,
 lgk05sc1, lgk06sc1, lgk07sc1, lgk08sc1, lgk09sc1, lgk10sc1, lgk11sc1a,
 lgk12sc1a, lgk13sc1a, lgk14sc1a, lgk15sc1a, lgk16sc1a, lgk17sc1a,
 lgk18sc1a, lgk19sc1a, lgk20sc1a, lgk21sc1a, lgk22sc1a, lgk23sc1a,
 lgk24sc1a, lgk25sc1a, lgk26sc1a, lgk27sc1a, lgk28sc1a, lgk29sc1a, lgk30sc1a).
EXECUTE.
lgoatm1/2

Mean item answer time (in seconds) for the twin GOAL web test.
Computed as lgoatm1 in the syntax below, and later copied to variable lgoatm2 on double entry.

COMPUTE lgoatm1 = MEAN(lgo01at1,lgo02at1,lgo03at1,
 lgo04at1,lgo05at1,lgo06at1,lgo07at1,lgo08at1,
 lgo09at1,lgo10at1,lgo11at1,lgo12at1,lgo13at1,lgo14at1,lgo15at1,lgo16at1,
 lgo17at1,lgo18at1,lgo19at1,lgo20at1,lgo21at1,lgo22at1,lgo23at1,lgo24at1,
 lgo25at1,lgo26at1,lgo27at1,lgo28at1,lgo29at1,lgo30at1,lgo31at1,lgo32at1,
 lgo33at1,lgo34at1,lgo35at1,lgo36at1).
lgotota1/2

Adjusted version of the total score for the GOAL web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, can discontinue from item 5 onwards.
* Copy existing item scores into temporary variables.
RECODE lgo05sc1 lgo06sc1 lgo07sc1 lgo08sc1 lgo09sc1 lgo10sc1
 lgo11sc1 lgo12sc1 lgo13sc1 lgo14sc1 lgo15sc1 lgo16sc1 lgo17sc1
 lgo18sc1 lgo19sc1 lgo20sc1 lgo21sc1 lgo22sc1 lgo23sc1 lgo24sc1
 lgo25sc1 lgo26sc1 lgo27sc1 lgo28sc1 lgo29sc1 lgo30sc1 lgo31sc1
 lgo32sc1 lgo33sc1 lgo34sc1 lgo35sc1 lgo36sc1
 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lgo05sc1a lgo06sc1a lgo07sc1a lgo08sc1a lgo09sc1a lgo10sc1a
 lgo11sc1a lgo12sc1a lgo13sc1a lgo14sc1a lgo15sc1a lgo16sc1a lgo17sc1a
 lgo18sc1a lgo19sc1a lgo20sc1a lgo21sc1a lgo22sc1a lgo23sc1a lgo24sc1a
 lgo25sc1a lgo26sc1a lgo27sc1a lgo28sc1a lgo29sc1a lgo30sc1a lgo31sc1a
 lgo32sc1a lgo33sc1a lgo34sc1a lgo35sc1a lgo36sc1a.
EXECUTE.
* Where discontinued, replace score of 0 with score of 0.25.
* (each item has 4 possible responses, so chance score is 1/4).
IF (lgo05an1 = -2) lgo05sc1a = 0.25.
IF (lgo06an1 = -2) lgo06sc1a = 0.25.
IF (lgo07an1 = -2) lgo07sc1a = 0.25.
IF (lgo08an1 = -2) lgo08sc1a = 0.25.
IF (lgo09an1 = -2) lgo09sc1a = 0.25.
IF (lgo10an1 = -2) lgo10sc1a = 0.25.
IF (lgo11an1 = -2) lgo11sc1a = 0.25.
IF (lgo12an1 = -2) lgo12sc1a = 0.25.
IF (lgo13an1 = -2) lgo13sc1a = 0.25.
IF (lgo14an1 = -2) lgo14sc1a = 0.25.
IF (lgo15an1 = -2) lgo15sc1a = 0.25.
IF (lgo16an1 = -2) lgo16sc1a = 0.25.
IF (lgo17an1 = -2) lgo17sc1a = 0.25.
IF (lgo18an1 = -2) lgo18sc1a = 0.25.
IF (lgo19an1 = -2) lgo19sc1a = 0.25.
IF (lgo20an1 = -2) lgo20sc1a = 0.25.
IF (lgo21an1 = -2) lgo21sc1a = 0.25.
IF (lgo22an1 = -2) lgo22sc1a = 0.25.
IF (lgo23an1 = -2) lgo23sc1a = 0.25.
IF (lgo24an1 = -2) lgo24sc1a = 0.25.
IF (lgo25an1 = -2) lgo25sc1a = 0.25.
IF (lgo26an1 = -2) lgo26sc1a = 0.25.
IF (lgo27an1 = -2) lgo27sc1a = 0.25.
IF (lgo28an1 = -2) lgo28sc1a = 0.25.
IF (lgo29an1 = -2) lgo29sc1a = 0.25.
IF (lgo30an1 = -2) lgo30sc1a = 0.25.
IF (lgo31an1 = -2) lgo31sc1a = 0.25.
IF (lgo32an1 = -2) lgo32sc1a = 0.25.
IF (lgo33an1 = -2) lgo33sc1a = 0.25.
IF (lgo34an1 = -2) lgo34sc1a = 0.25.
IF (lgo35an1 = -2) lgo35sc1a = 0.25.
IF (lgo36an1 = -2) lgo36sc1a = 0.25.
EXECUTE.
* Compute total score out of 36 using original items 1-4.
* plus the new adjusted items 5-36.
COMPUTE lgotota1 = SUM(lgo01sc1, lgo02sc1, lgo03sc1, lgo04sc1, lgo05sc1a,
 lgo06sc1a, lgo07sc1a, lgo08sc1a, lgo09sc1a, lgo10sc1a, lgo11sc1a, lgo12sc1a,
 lgo13sc1a, lgo14sc1a, lgo15sc1a, lgo16sc1a, lgo17sc1a, lgo18sc1a, lgo19sc1a,
 lgo20sc1a, lgo21sc1a, lgo22sc1a, lgo23sc1a, lgo24sc1a, lgo25sc1a, lgo26sc1a,
 lgo27sc1a, lgo28sc1a, lgo29sc1a, lgo30sc1a, lgo31sc1a, lgo32sc1a, lgo33sc1a,
 lgo34sc1a, lgo35sc1a, lgo36sc1a).
EXECUTE.
lhsatm1/2

Mean item answer time (in seconds) for the twin Hidden Shapes web test.
Computed as lhsatm1 in the syntax below, and later copied to variable lhsatm2 on double entry.

COMPUTE lhsatm1 = MEAN(lhs01at1,lhs02at1,lhs03at1,
 lhs04at1,lhs05at1,lhs06at1,lhs07at1,lhs08at1,
 lhs09at1,lhs10at1,lhs11at1,lhs12at1,lhs13at1,lhs14at1,lhs15at1,lhs16at1,
 lhs17at1,lhs18at1,lhs19at1,lhs20at1,lhs21at1,lhs22at1,lhs23at1,lhs24at1,
 lhs25at1,lhs26at1,lhs27at1).
lhstota1/2

Adjusted version of the total score for the Hidden Shapes web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, items 4-9 and 13-27 can be discontinued.
* Copy existing item scores into temporary variables.
RECODE lhs04sc1 lhs05sc1 lhs06sc1 lhs07sc1 lhs08sc1 lhs09sc1
 lhs13sc1 lhs14sc1 lhs15sc1 lhs16sc1 lhs17sc1 lhs18sc1 lhs19sc1
 lhs20sc1 lhs21sc1 lhs22sc1 lhs23sc1 lhs24sc1 lhs25sc1 lhs26sc1 lhs27sc1
 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lhs04sc1a lhs05sc1a lhs06sc1a lhs07sc1a lhs08sc1a lhs09sc1a
 lhs13sc1a lhs14sc1a lhs15sc1a lhs16sc1a lhs17sc1a lhs18sc1a lhs19sc1a
 lhs20sc1a lhs21sc1a lhs22sc1a lhs23sc1a lhs24sc1a lhs25sc1a lhs26sc1a lhs27sc1a .
EXECUTE.
* Where discontinued, replace score of 0 with score of 0.25.
* (each item has 4 possible responses, so chance score is 1/4).
IF (lhs04an1 = -2) lhs04sc1a = 0.25.
IF (lhs05an1 = -2) lhs05sc1a = 0.25.
IF (lhs06an1 = -2) lhs06sc1a = 0.25.
IF (lhs07an1 = -2) lhs07sc1a = 0.25.
IF (lhs08an1 = -2) lhs08sc1a = 0.25.
IF (lhs09an1 = -2) lhs09sc1a = 0.25.
IF (lhs13an1 = -2) lhs13sc1a = 0.25.
IF (lhs14an1 = -2) lhs14sc1a = 0.25.
IF (lhs15an1 = -2) lhs15sc1a = 0.25.
IF (lhs16an1 = -2) lhs16sc1a = 0.25.
IF (lhs17an1 = -2) lhs17sc1a = 0.25.
IF (lhs18an1 = -2) lhs18sc1a = 0.25.
IF (lhs19an1 = -2) lhs19sc1a = 0.25.
IF (lhs20an1 = -2) lhs20sc1a = 0.25.
IF (lhs21an1 = -2) lhs21sc1a = 0.25.
IF (lhs22an1 = -2) lhs22sc1a = 0.25.
IF (lhs23an1 = -2) lhs23sc1a = 0.25.
IF (lhs24an1 = -2) lhs24sc1a = 0.25.
IF (lhs25an1 = -2) lhs25sc1a = 0.25.
IF (lhs26an1 = -2) lhs26sc1a = 0.25.
IF (lhs27an1 = -2) lhs27sc1a = 0.25.
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE lhstota1 = SUM(lhs01sc1, lhs02sc1, lhs03sc1, lhs04sc1a,
 lhs05sc1a, lhs06sc1a, lhs07sc1a, lhs08sc1a, lhs09sc1a, lhs10sc1,
 lhs11sc1, lhs12sc1, lhs13sc1a, lhs14sc1a, lhs15sc1a, lhs16sc1a,
 lhs17sc1a, lhs18sc1a, lhs19sc1a, lhs20sc1a, lhs21sc1a, lhs22sc1a,
 lhs23sc1a, lhs24sc1a, lhs25sc1a, lhs26sc1a, lhs27sc1a).
EXECUTE.
linatm1/2

Mean item answer time (in seconds) for the twin Inferences web test.
Computed as linatm1 in the syntax below, and later copied to variable linatm2 on double entry.

COMPUTE linatm1 = MEAN(lin01at1,lin02at1,lin03at1,
 lin04at1,lin05at1,lin06at1,lin07at1,lin08at1,
 lin09at1,lin10at1,lin11at1).
ljgatm1/2

Mean item answer time (in seconds) for the twin Jigsaws web test.
Computed as ljgatm1 in the syntax below, and later copied to variable ljgatm2 on double entry.

COMPUTE ljgatm1 = MEAN(ljg01at1,ljg02at1,ljg03at1,
 ljg04at1,ljg05at1,ljg06at1,ljg07at1,ljg08at1,
 ljg09at1,ljg10at1,ljg11at1,ljg12at1,ljg13at1,ljg14at1,ljg15at1,ljg16at1,
 ljg17at1,ljg18at1,ljg19at1,ljg20at1,ljg21at1,ljg22at1,ljg23at1,ljg24at1,
 ljg25at1,ljg26at1,ljg27at1,ljg28at1).
ljgtota1/2

Adjusted version of the total score for the Jigsaws web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, items 4-8 and 12-28 can be discontinued.
* Copy existing item scores into temporary variables.
RECODE ljg04sc1 ljg05sc1 ljg06sc1 ljg07sc1 ljg08sc1
 ljg12sc1 ljg13sc1 ljg14sc1 ljg15sc1 ljg16sc1 ljg17sc1
 ljg18sc1 ljg19sc1 ljg20sc1 ljg21sc1 ljg22sc1 ljg23sc1
 ljg24sc1 ljg25sc1 ljg26sc1 ljg27sc1 ljg28sc1
 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO ljg04sc1a ljg05sc1a ljg06sc1a ljg07sc1a ljg08sc1a
 ljg12sc1a ljg13sc1a ljg14sc1a ljg15sc1a ljg16sc1a ljg17sc1a
 ljg18sc1a ljg19sc1a ljg20sc1a ljg21sc1a ljg22sc1a ljg23sc1a
 ljg24sc1a ljg25sc1a ljg26sc1a ljg27sc1a ljg28sc1a .
EXECUTE.
* Where discontinued, replace score of 0 with score of 0.25.
* (each item has 4 possible responses, so chance score is 1/4).
IF (ljg04an1 = -2) ljg04sc1a = 0.25.
IF (ljg05an1 = -2) ljg05sc1a = 0.25.
IF (ljg06an1 = -2) ljg06sc1a = 0.25.
IF (ljg07an1 = -2) ljg07sc1a = 0.25.
IF (ljg08an1 = -2) ljg08sc1a = 0.25.
IF (ljg12an1 = -2) ljg12sc1a = 0.25.
IF (ljg13an1 = -2) ljg13sc1a = 0.25.
IF (ljg14an1 = -2) ljg14sc1a = 0.25.
IF (ljg15an1 = -2) ljg15sc1a = 0.25.
IF (ljg16an1 = -2) ljg16sc1a = 0.25.
IF (ljg17an1 = -2) ljg17sc1a = 0.25.
IF (ljg18an1 = -2) ljg18sc1a = 0.25.
IF (ljg19an1 = -2) ljg19sc1a = 0.25.
IF (ljg20an1 = -2) ljg20sc1a = 0.25.
IF (ljg21an1 = -2) ljg21sc1a = 0.25.
IF (ljg22an1 = -2) ljg22sc1a = 0.25.
IF (ljg23an1 = -2) ljg23sc1a = 0.25.
IF (ljg24an1 = -2) ljg24sc1a = 0.25.
IF (ljg25an1 = -2) ljg25sc1a = 0.25.
IF (ljg26an1 = -2) ljg26sc1a = 0.25.
IF (ljg27an1 = -2) ljg27sc1a = 0.25.
IF (ljg28an1 = -2) ljg28sc1a = 0.25.
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE ljgtota1 = SUM(ljg01sc1, ljg02sc1, ljg03sc1,
 ljg04sc1a, ljg05sc1a, ljg06sc1a, ljg07sc1a, ljg08sc1a,
 ljg09sc1, ljg10sc1, ljg11sc1, ljg12sc1a, ljg13sc1a, ljg14sc1a,
 ljg15sc1a, ljg16sc1a, ljg17sc1a, ljg18sc1a, ljg19sc1a, ljg20sc1a,
 ljg21sc1a, ljg22sc1a, ljg23sc1a, ljg24sc1a, ljg25sc1a, ljg26sc1a, ljg27sc1a, ljg28sc1a).
EXECUTE.
llitenf1/2

Full Literacy Environment scale.
Derived from items in the twin Maths and Reading web questionnaire.
Computed as llitenf1 in the syntax below, and later copied to variable llitenf2 on double entry.

* Reading items 13/14/15 are coded 1-3, whereas the rest are coded 1-4.
* so recode to a comparable scale and reverse-code items 13 and 14.
* these recoded variables are temporary, and will be dropped later.
RECODE lqr15an1 
  (1=1) (2=2.5) (3=4) (SYSMIS=SYSMIS)
INTO qr15an1.
RECODE lqr13an1 lqr14an1 
  (1=4) (2=2.5) (3=1) (SYSMIS=SYSMIS)
INTO qr13an1 qr14an1.
EXECUTE.

* From all 17 reading-related items, requiring.
* at least 11 items for the scale.
* As above, use the recoded versions of items 13/14/15.
* Uses the additional items added for the second wave.
* so do not compute this scale for cohort 1.
DO IF (lcohort > 1).
  COMPUTE llitenf1 = MEAN.11(lqr01an1,lqr02an1,lqr03an1,
    lqr04an1,lqr05an1,lqr06an1,lqr07an1,
 	lqr08an1,lqr09an1,lqr10an1,lqr11an1,lqr12an1,qr13an1,
 	qr14an1,qr15an1,lqr16an1,lqr17an1).
END IF.
EXECUTE.
llitenv1/2

Literacy Environment scale.
Derived from items in the twin Maths and Reading web questionnaire.
Computed as llitenv1 in the syntax below, and later copied to variable llitenv2 on double entry.

* Scale requires at least 3 of the 5 items.
* Each item has ordinal values 1-4, with 4 indicating the most literacy.
* These items were included in both the first and.
* second waves of assessment (available for all cohorts).
COMPUTE llitenv1 = MEAN.3(lqr01an1,lqr02an1,lqr03an1,lqr04an1,lqr05an1).
EXECUTE.
llitenx1/2

Extended Literacy Environment scale.
Derived from items in the twin Maths and Reading web questionnaire.
Computed as llitenx1 in the syntax below, and later copied to variable llitenx2 on double entry.

* Reading items 13/14/15 are coded 1-3, whereas the rest are coded 1-4.
* so recode to a comparable scale.
* and at the same time, reverse-code items 13 and 14.
RECODE lqr15an1 
  (1=1) (2=2.5) (3=4) (SYSMIS=SYSMIS)
INTO qr15an1.
RECODE lqr13an1 lqr14an1 
  (1=4) (2=2.5) (3=1) (SYSMIS=SYSMIS)
INTO qr13an1 qr14an1.
EXECUTE.
* these recoded variables are temporary, and will be dropped later.

* Scale requires at least 8 of the 12 items.
* This is based on 12 additional items added for.
* second wave of assessment (not available for cohort 1). 
COMPUTE llitenx1 = MEAN.8(lqr06an1,lqr07an1,lqr08an1,lqr09an1,lqr10an1,
	lqr11an1,lqr12an1,qr13an1,qr14an1,qr15an1,lqr16an1,lqr17an1).
EXECUTE.
lma1tot1/2, lma2tot1/2, lma3tot1/2

Scores for sub-test categories 1, 2 and 3 respectively of the Maths web test.
Derived from item score variables in the test.
Computed as lma1tot1/lma2tot1/lma3tot1 in the syntax below, then copied into variables lma1tot2/lma2tot2/lma3tot2 on double entry.

COMPUTE lma1tot1 = SUM(lm111sc1, lm121sc1, lm122sc1, lm123sc1, lm131sc1,
 lm132sc1, lm133sc1, lm134sc1, lm141sc1, lm142sc1, lm143sc1, lm144sc1,
 lm151sc1, lm152sc1, lm153sc1, lm154sc1, lm155sc1, lm156sc1, lm157sc1, 
 lm161sc1, lm162sc1, lm163sc1, lm164sc1, lm171sc1, lm172sc1, lm173sc1,
 lm174sc1, lm181sc1, lm182sc1, lm183sc1, lm184sc1, lm185sc1, lm186sc1).
COMPUTE lma2tot1 = SUM(lm211sc1, lm221sc1, lm222sc1, lm223sc1, lm224sc1,
 lm231sc1, lm251sc1, lm252sc1, lm253sc1, lm254sc1, lm255sc1, lm261sc1,
 lm262sc1, lm263sc1, lm264sc1, lm265sc1, lm266sc1, lm271sc1, lm281sc1,
 lm282sc1, lm283sc1, lm284sc1, lm285sc1, lm286sc1, lm287sc1).
COMPUTE lma3tot1 = SUM(lm311sc1, lm321sc1, lm322sc1, lm323sc1, lm324sc1, 
 lm325sc1, lm331sc1, lm332sc1, lm333sc1, lm341sc1, lm342sc1, lm343sc1,
 lm344sc1, lm345sc1, lm346sc1, lm347sc1, lm348sc1, lm351sc1, lm352sc1,
 lm353sc1, lm354sc1, lm355sc1, lm356sc1, lm361sc1, lm362sc1, lm363sc1,
 lm364sc1, lm365sc1, lm371sc1, lm372sc1, lm373sc1, lm381sc1, lm382sc1,
 lm383sc1, lm384sc1, lm385sc1, lm386sc1).
EXECUTE.
lmaatm1/2

Mean item answer time (in seconds) for the twin Maths web test.
Computed as lmaatm1 in the syntax below, and later copied to variable lmaatm2 on double entry.

COMPUTE lmaatm1 = MEAN(lm111at1,lm121at1,lm122at1,
  lm123at1,lm131at1,lm132at1,lm133at1,
  lm134at1,lm141at1,lm142at1,lm143at1,lm144at1,lm151at1,lm152at1,lm153at1,
  lm154at1,lm155at1,lm156at1,lm157at1,lm161at1,lm162at1,lm163at1,lm164at1,
  lm171at1,lm172at1,lm173at1,lm174at1,lm181at1,lm182at1,lm183at1,lm184at1,
  lm185at1,lm186at1,lm211at1,lm221at1,lm222at1,lm223at1,lm224at1,lm231at1,
  lm251at1,lm252at1,lm253at1,lm254at1,lm255at1,lm261at1,lm262at1,lm263at1,
  lm264at1,lm265at1,lm266at1,lm271at1,lm281at1,lm282at1,lm283at1,lm284at1,
  lm285at1,lm286at1,lm287at1,lm311at1,lm321at1,lm322at1,lm323at1,lm324at1,
  lm325at1,lm331at1,lm332at1,lm333at1,lm341at1,lm342at1,lm343at1,lm344at1,
  lm345at1,lm346at1,lm347at1,lm348at1,lm351at1,lm352at1,lm353at1,lm354at1,
  lm355at1,lm356at1,lm361at1,lm362at1,lm363at1,lm364at1,lm365at1,lm371at1,
  lm372at1,lm373at1,lm381at1,lm382at1,lm383at1,lm384at1,lm385at1,lm386at1).
lmatenv1/2

Mathematics Environment scale.
Derived from items in the twin Maths and Reading web questionnaire.
Computed as lmatenv1 in the syntax below, and later copied to variable lmatenv2 on double entry.

* Scale requires at least 2 of the 3 items.
* Each item has ordinal values 1-4, with 4 indicating the most maths.
* These items were included in both the first and second.
* waves of assessment (available for all cohorts).
COMPUTE lmatenv1 = MEAN.2(lqma2an1,lqma3an1,lqma4an1).
EXECUTE.
lmatota1/2

Adjusted version of the total score for the Maths web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* Discontinue rules apply after basal points in each subtest.
* so only some items are affected.
* Also some items have negligible chance scores, so are not recoded.
* Where appropriate, copy existing item scores into temporary variables.
RECODE lm133sc1 lm144sc1 lm155sc1 lm156sc1 lm157sc1 lm162sc1
 lm171sc1 lm174sc1 lm183sc1 lm186sc1 lm223sc1 lm231sc1 lm254sc1
 lm261sc1 lm263sc1 lm264sc1 lm265sc1 lm266sc1 lm283sc1 lm284sc1
 lm285sc1 lm286sc1 lm287sc1 lm323sc1 lm346sc1 lm347sc1 lm354sc1
 lm355sc1 lm364sc1 lm365sc1 lm385sc1 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lm133sc1a lm144sc1a lm155sc1a lm156sc1a lm157sc1a lm162sc1a
 lm171sc1a lm174sc1a lm183sc1a lm186sc1a lm223sc1a lm231sc1a lm254sc1a
 lm261sc1a lm263sc1a lm264sc1a lm265sc1a lm266sc1a lm283sc1a lm284sc1a
 lm285sc1a lm286sc1a lm287sc1a lm323sc1a lm346sc1a lm347sc1a lm354sc1a
 lm355sc1a lm364sc1a lm365sc1a lm385sc1a .
EXECUTE.
* Where discontinued, replace score of 0 with chance score.
* Chance scores vary from item to item due to different response formats.
* Where twins have to type in numeric answers, the chance score is effectively zero.
* Also, ignore items in which permutations of responses mean that.
* the chance score is less than 0.1.
IF (lm133an1 = -2) lm133sc1a = 0.2.
IF (lm144an1 = -2) lm144sc1a = 0.2.
IF (lm155an1 = -2) lm155sc1a = 0.2.
IF (lm156an1 = '-2') lm156sc1a = (1 / 6).
IF (lm157an1 = -2) lm157sc1a = 0.25.
IF (lm162an1 = -2) lm162sc1a = 0.2.
IF (lm171an1 = -2) lm171sc1a = 0.2.
IF (lm174an1 = -2) lm174sc1a = 0.2.
IF (lm183an1 = -2) lm183sc1a = 0.2.
IF (lm186an1 = -2) lm186sc1a = (1 / 6).
IF (lm223an1 = -2) lm223sc1a = 0.2.
IF (lm231an1 = -2) lm231sc1a = 0.2.
IF (lm254an1 = '-2') lm254sc1a = 0.1.
IF (lm261an1 = -2) lm261sc1a = (1 / 3).
IF (lm263an1 = -2) lm263sc1a = 0.25.
IF (lm264an1 = '-2') lm264sc1a = 0.1.
IF (lm265an1 = -2) lm265sc1a = 0.25.
IF (lm266an1 = -2) lm266sc1a = 0.2.
IF (lm283an1 = -2) lm283sc1a = 0.25.
IF (lm284an1 = -2) lm284sc1a = 0.25.
IF (lm285an1 = '-2') lm285sc1a = 0.1.
IF (lm286an1 = -2) lm286sc1a = (1 / 6).
IF (lm287an1 = -2) lm287sc1a = 0.25.
IF (lm323an1 = '-2') lm323sc1a = 0.2.
IF (lm346an1 = -2) lm346sc1a = 0.2.
IF (lm347an1 = -2) lm347sc1a = 0.2.
IF (lm354an1 = -2) lm354sc1a = 0.2.
IF (lm355an1 = -2) lm355sc1a = 0.2.
IF (lm364an1 = -2) lm364sc1a = 0.2.
IF (lm365an1 = -2) lm365sc1a = 0.2.
IF (lm385an1 = -2) lm385sc1a = 0.25.
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE lmatota1 = SUM(lm133sc1a, lm144sc1a, lm155sc1a, lm156sc1a, lm157sc1a,
 lm162sc1a, lm171sc1a, lm174sc1a, lm183sc1a, lm186sc1a, lm223sc1a, lm231sc1a,
 lm254sc1a, lm261sc1a, lm263sc1a, lm264sc1a, lm265sc1a, lm266sc1a, lm283sc1a,
 lm284sc1a, lm285sc1a, lm286sc1a, lm287sc1a, lm323sc1a, lm346sc1a, lm347sc1a,
 lm354sc1a, lm355sc1a, lm364sc1a, lm365sc1a, lm385sc1a,
 lm111sc1, lm121sc1, lm122sc1, lm123sc1, lm131sc1, lm132sc1, lm134sc1, lm141sc1,
 lm142sc1, lm143sc1, lm151sc1, lm152sc1, lm153sc1, lm154sc1, lm161sc1, lm163sc1,
 lm164sc1, lm172sc1, lm173sc1, lm181sc1, lm182sc1, lm184sc1, lm185sc1, lm211sc1,
 lm221sc1, lm222sc1, lm224sc1, lm251sc1, lm252sc1, lm253sc1, lm255sc1, lm262sc1,
 lm271sc1, lm281sc1, lm282sc1, lm311sc1, lm321sc1, lm322sc1, lm324sc1, lm325sc1,
 lm331sc1, lm332sc1, lm333sc1, lm341sc1, lm342sc1, lm343sc1, lm344sc1, lm345sc1,
 lm348sc1, lm351sc1, lm352sc1, lm353sc1, lm356sc1, lm361sc1, lm362sc1, lm363sc1,
 lm371sc1, lm372sc1, lm373sc1, lm381sc1, lm382sc1, lm383sc1, lm384sc1, lm386sc1).
EXECUTE.
lp2ac1/2, lp3ac1/2, lt2ac1/2, lt3ac1/3, lteng1/2, ltmat1/2, ltsci1/2

Mean twin National Curriculum levels as measures of academic achievement. These derive from raw NC levels reported in the teacher questionnaire ("lt" variables) and reported by parents from end-of-term school reports ("lp" variables). The variables derived are:
lp2ac: 2-subject (maths, English) mean from parent reports;
lp3ac: 3-subject (maths, English, science) from parent reports;
lt2ac: 2-subject (maths, English) mean from teacher qnr;
lt3ac: 3-subject (maths, English, science) from teacher qnr;
lteng: mean teacher English level;
ltmat: mean teacher Maths level;
ltsci: mean teacher Science level.
In all cases, by definition, NC levels are measures on the national scale of achievement levels from 1 to 8 and occasionally 9="exceptional performance".

* Non-standardised achievement means.
* The standardised means (like lt2a1/2) have been used historically.
* but simpler mean achievement levels can be used instead.
* and have the benefit of retaining the National Curriculum levels as scores.
* which should be equivalent across ages (7 to 14 in TEDS).
* Derive for teacher-reported assessments (English, maths, science, overall).
* and for the end-of-term teacher levels collected from parents (overall).
* Teacher-reported English, maths, science: mean of component reported levels.
COMPUTE lteng1 = MEAN(ltengsp1, ltengre1, ltengwr1).
COMPUTE ltmat1 = MEAN(ltmatus1, ltmatnu1, ltmatsh1, ltmatha1).
COMPUTE ltsci1 = MEAN(ltscisc1, ltscili1, ltscima1, ltsciph1).
EXECUTE.
* 2-subject (English and maths) overall achievement.
* requiring both to be non-missing.
COMPUTE lt2ac1 = MEAN.2(lteng1, ltmat1).
COMPUTE lp2ac1 = MEAN.2(lpnceng1, lpncmat1).
EXECUTE.
* 3-subject (English, maths, science) overall achievement.
* requiring all three to be non-missing.
COMPUTE lt3ac1 = MEAN.3(lteng1, ltmat1, ltsci1).
COMPUTE lp3ac1 = MEAN.3(lpnceng1, lpncmat1, lpncsci1).
EXECUTE.
* All results came ultimately from teachers.
* The teacher data were reported directly to TEDS mid-term in the questionnaire.
* The parent data were reported to TEDS at the end of the school year.
* from the school reports.
lpapsdt1/2, ltapsdt1/2

APSD Total scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-40.
Each is derived from 20 APSD items, requiring at least 10 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* All the callous-unemotional, narcissism and impulsivity items plus two others.
* 20 items (5 of them reversed), require at least 10 of them for each scale.
COMPUTE lpapsdt1 = 20 * MEAN.10(lpaps011, lpaps021, lpap03r1, lpaps041, 
  lpaps051, lpaps061, lpap07r1, lpaps081, lpaps091, lpaps101, lpaps111, lpap12r1, 
  lpaps131, lpaps141, lpaps151, lpaps161, lpaps171, lpap18r1, lpaps191, lpap20r1).
COMPUTE ltapsdt1 = 20 * MEAN.10(ltaps011, ltaps021, ltap03r1, ltaps041, 
  ltaps051, ltaps061, ltap07r1, ltaps081, ltaps091, ltaps101, ltaps111, ltap12r1, 
  ltaps131, ltaps141, ltaps151, ltaps161, ltaps171, ltap18r1, ltaps191, ltap20r1).
EXECUTE.
lpcacot1/2, ltcacot1/2

CAST Communication scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-12.
Each is derived from 12 CAST items, requiring at least 6 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 12 items, require at least 6 of them for the scale.
COMPUTE lpcacot1 = 12 * MEAN.6(lpcas051, lpca07r1, lpca08r1, lpca13r1, 
	lpcas141, lpcas161, lpca18r1, lpcas201, lpcas241, lpcas261, lpcas291, lpcas301).
COMPUTE ltcacot1 = 12 * MEAN.6(ltcas051, ltca07r1, ltca08r1, ltca13r1, 
	ltcas141, ltcas161, ltca18r1, ltcas201, ltcas241, ltcas261, ltcas291, ltcas301).
EXECUTE.
lpcalt1/2, ltcalt1/2

APSD Callous-Unemotional (CU) scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-12.
Each is derived from 6 APSD items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 6 items (5 of them reversed), require at least 3 of them for each scale.
COMPUTE lpcalt1 = 6 * MEAN.3(lpap03r1, lpap07r1, lpap12r1,
 lpap18r1, lpaps191, lpap20r1).
COMPUTE ltcalt1 = 6 * MEAN.3(ltap03r1, ltap07r1, ltap12r1,
 ltap18r1, ltaps191, ltap20r1).
EXECUTE.
lpcanot1/2, ltcanot1/2

CAST Non-Social scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-7.
Each is derived from 7 CAST items, requiring at least 4 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 7 items, require at least 4 of them for the scale.
COMPUTE lpcanot1 = 7 * MEAN.4(lpcas041, lpcas061, lpca09r1,
 lpcas101, lpcas151, lpcas221, lpcas271).
COMPUTE ltcanot1 = 7 * MEAN.4(ltcas041, ltcas061, ltca09r1,
 ltcas101, ltcas151, ltcas221, ltcas271).
EXECUTE.
lpcasot1/2, ltcasot1/2

CAST Social scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-11.
Each is derived from 11 CAST items, requiring at least 6 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 11 items, require at least 6 of them for the scale.
COMPUTE lpcasot1 = 11 * MEAN.6(lpca01r1, lpca02r1, lpca03r1, lpca11r1,
 lpca12r1, lpca17r1, lpca19r1, lpca21r1, lpcas231, lpca25r1, lpca28r1).
COMPUTE ltcasot1 = 11 * MEAN.6(ltca01r1, ltca02r1, ltca03r1, ltca11r1,
 ltca12r1, ltca17r1, ltca19r1, ltca21r1, ltcas231, ltca25r1, ltca28r1).
EXECUTE.
lpcastt1/2, ltcastt1/2

CAST Total scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-30.
Each is derived from 30 CAST items, requiring at least 15 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 30 items, require at least 15 of them for the scale.
COMPUTE lpcastt1 = 30 * MEAN.15(lpca01r1, lpca02r1, lpca03r1, lpcas041,
 lpcas051, lpcas061, lpca07r1, lpca08r1, lpca09r1, lpcas101, lpca11r1,
 lpca12r1, lpca13r1, lpcas141, lpcas151, lpcas161, lpca17r1, lpca18r1,
 lpca19r1, lpcas201, lpca21r1, lpcas221, lpcas231, lpcas241, lpca25r1,
 lpcas261, lpcas271, lpca28r1, lpcas291, lpcas301).
COMPUTE ltcastt1 = 30 * MEAN.15(ltca01r1, ltca02r1, ltca03r1, ltcas041,
 ltcas051, ltcas061, ltca07r1, ltca08r1, ltca09r1, ltcas101, ltca11r1,
 ltca12r1, ltca13r1, ltcas141, ltcas151, ltcas161, ltca17r1, ltca18r1,
 ltca19r1, ltcas201, ltca21r1, ltcas221, ltcas231, ltcas241, ltca25r1,
 ltcas261, ltcas271, ltca28r1, ltcas291, ltcas301).
EXECUTE.
lpcatm1/2

Mean item answer time (in seconds) for the twin Picture Completion web test.
Computed as lpcatm1 in the syntax below, and later copied to variable lpcatm2 on double entry.

COMPUTE lpcatm1 = MEAN(lpcp1at1,lpc01at1,lpc02at1,
 lpc03at1,lpc04at1,lpc05at1,lpc06at1,lpc07at1,lpc08at1,
 lpc09at1,lpc10at1,lpc11at1,lpc12at1,lpc13at1,lpc14at1,lpc15at1,lpc16at1,
 lpc17at1,lpc18at1,lpc19at1,lpc20at1,lpc21at1,lpc22at1,lpc23at1,lpc24at1,
 lpc25at1,lpc26at1,lpc27at1,lpc28at1,lpc29at1,lpc30at1).
lpchatot

See lcchato1/2, lpchatot above.

lpconhit1/2

Conners Hyperactivity-Impulsivity scales.
Derived from Conners items in the parent booklet.
Total score with range 0-27.
Computed from 9 Conners items, requiring at least 5 of the items to be non-missing.

* From 9 of the 18 Conners items, each having values between 0 and 3.
COMPUTE lpconhit1 = 9 * MEAN.5(lpcon011,lpcon051,lpcon081,lpcon101,
	lpcon111,lpcon131,lpcon141,lpcon161,lpcon181).
EXECUTE .
lpconint1/2

Conners Inattention scales.
Derived from Conners items in the parent booklet.
Total score with range 0-27.
Computed from 9 Conners items, requiring at least 5 of the items to be non-missing.

* Inattention scale.
* From 9 of the 18 Conners items, each having values between 0 and 3.
COMPUTE lpconint1 = 9 * MEAN.5(lpcon021,lpcon031,lpcon041,lpcon061,
	lpcon071,lpcon091,lpcon121,lpcon151,lpcon171).
EXECUTE .
lpconnt1/2

Conners Total scales.
Derived from Conners items in the parent booklet.
Total score with range 0-54.
Computed from 18 Conners items, requiring at least 9 of the items to be non-missing.

* Sum of all 18 Conners items, each scored 0 to 3.
* Scale requires at least 9 of the items to be non-missing.
COMPUTE lpconnt1 = 18 * MEAN.9(lpcon011,lpcon021,lpcon031,
 lpcon041,lpcon051,lpcon061,
 lpcon071,lpcon081,lpcon091,lpcon101,lpcon111,lpcon121,
 lpcon131,lpcon141,lpcon151,lpcon161,lpcon171,lpcon181).
EXECUTE.
lpdata

Flag variable to show the presence of parent data (1=yes, 0=no) in the 12 year dataset.
Parent questionnaire data may be present either from the parent booklet (flagged by item variable lpqdata) or from the SRS CAST questionnaire (flagged by item variable lsrsdata).

COMPUTE lpdata = 0.
IF (lpqdata = 1 | lsrsdata = 1) lpdata = 1.
EXECUTE.
lpdisavot1/2, lpdisnegt1/2, lpdispost1/2

See lcdisavot1/2, etc above.

lpiatm1/2

Mean item answer time (in seconds) for the twin PIAT web test.
Computed as lpiatm1 in the syntax below, and later copied to variable lpiatm2 on double entry.

COMPUTE lpiatm1 = MEAN(lpip3at1,lpip4at1,lpip5at1,
 lpi19at1,lpi20at1,lpi21at1,lpi22at1,lpi23at1,lpi24at1,
 lpi25at1,lpi26at1,lpi27at1,lpi28at1,lpi29at1,lpi30at1,lpi31at1,lpi32at1,
 lpi33at1,lpi34at1,lpi35at1,lpi36at1,lpi37at1,lpi38at1,lpi39at1,lpi40at1,
 lpi41at1,lpi42at1,lpi43at1,lpi44at1,lpi45at1,lpi46at1,lpi47at1,lpi48at1,
 lpi49at1,lpi50at1,lpi51at1,lpi52at1,lpi53at1,lpi54at1,lpi55at1,lpi56at1,
 lpi57at1,lpi58at1,lpi59at1,lpi60at1,lpi61at1,lpi62at1,lpi63at1,lpi64at1,
 lpi65at1,lpi66at1,lpi67at1,lpi68at1,lpi69at1,lpi70at1,lpi71at1,lpi72at1,
 lpi73at1,lpi74at1,lpi75at1,lpi76at1,lpi77at1,lpi78at1,lpi79at1,lpi80at1,
 lpi81at1,lpi82at1,lpi83at1,lpi84at1,lpi85at1,lpi86at1,lpi87at1,lpi88at1,
 lpi89at1,lpi90at1,lpi91at1,lpi92at1,lpi93at1,lpi94at1,lpi95at1,lpi96at1,
 lpi97at1,lpi98at1,lpi99at1,lp100at1).
lpimpt1/2, ltimpt1/2

APSD Impulsivity scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-10.
Each is derived from 5 APSD items, requiring at least 3 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 5 items, require at least 3 of them for each scale.
COMPUTE lpimpt1 = 5 * MEAN.3(lpaps011,lpaps041,lpaps091,lpaps131,lpaps171).
COMPUTE ltimpt1 = 5 * MEAN.3(ltaps011,ltaps041,ltaps091,ltaps131,ltaps171).
EXECUTE.
lpitota1/2

Adjusted version of the total score for the PIAT web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, can discontinue from item 23 onwards.
* Copy existing item scores into temporary variables.
RECODE lpi23sc1 lpi24sc1 lpi25sc1 lpi26sc1 lpi27sc1
 lpi28sc1 lpi29sc1 lpi30sc1 lpi31sc1 lpi32sc1 lpi33sc1 lpi34sc1 lpi35sc1 lpi36sc1 lpi37sc1
 lpi38sc1 lpi39sc1 lpi40sc1 lpi41sc1 lpi42sc1 lpi43sc1 lpi44sc1 lpi45sc1 lpi46sc1 lpi47sc1
 lpi48sc1 lpi49sc1 lpi50sc1 lpi51sc1 lpi52sc1 lpi53sc1 lpi54sc1 lpi55sc1 lpi56sc1 lpi57sc1
 lpi58sc1 lpi59sc1 lpi60sc1 lpi61sc1 lpi62sc1 lpi63sc1 lpi64sc1 lpi65sc1 lpi66sc1 lpi67sc1
 lpi68sc1 lpi69sc1 lpi70sc1 lpi71sc1 lpi72sc1 lpi73sc1 lpi74sc1 lpi75sc1 lpi76sc1 lpi77sc1
 lpi78sc1 lpi79sc1 lpi80sc1 lpi81sc1 lpi82sc1 lpi83sc1 lpi84sc1 lpi85sc1 lpi86sc1 lpi87sc1
 lpi88sc1 lpi89sc1 lpi90sc1 lpi91sc1 lpi92sc1 lpi93sc1 lpi94sc1 lpi95sc1 lpi96sc1 lpi97sc1
 lpi98sc1 lpi99sc1 lpi100sc1 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lpi23sc1a lpi24sc1a lpi25sc1a lpi26sc1a lpi27sc1a
 lpi28sc1a lpi29sc1a lpi30sc1a lpi31sc1a lpi32sc1a lpi33sc1a lpi34sc1a lpi35sc1a lpi36sc1a lpi37sc1a
 lpi38sc1a lpi39sc1a lpi40sc1a lpi41sc1a lpi42sc1a lpi43sc1a lpi44sc1a lpi45sc1a lpi46sc1a lpi47sc1a
 lpi48sc1a lpi49sc1a lpi50sc1a lpi51sc1a lpi52sc1a lpi53sc1a lpi54sc1a lpi55sc1a lpi56sc1a lpi57sc1a
 lpi58sc1a lpi59sc1a lpi60sc1a lpi61sc1a lpi62sc1a lpi63sc1a lpi64sc1a lpi65sc1a lpi66sc1a lpi67sc1a
 lpi68sc1a lpi69sc1a lpi70sc1a lpi71sc1a lpi72sc1a lpi73sc1a lpi74sc1a lpi75sc1a lpi76sc1a lpi77sc1a
 lpi78sc1a lpi79sc1a lpi80sc1a lpi81sc1a lpi82sc1a lpi83sc1a lpi84sc1a lpi85sc1a lpi86sc1a lpi87sc1a
 lpi88sc1a lpi89sc1a lpi90sc1a lpi91sc1a lpi92sc1a lpi93sc1a lpi94sc1a lpi95sc1a lpi96sc1a lpi97sc1a
 lpi98sc1a lpi99sc1a lpi100sc1a.
EXECUTE.
* Where discontinued, replace score of 0 with score of 0.25.
* (each item has 4 possible responses, so chance score is 1/4).
IF (lpi23an1 = -2) lpi23sc1a = 0.25.
IF (lpi24an1 = -2) lpi24sc1a = 0.25.
IF (lpi25an1 = -2) lpi25sc1a = 0.25.
IF (lpi26an1 = -2) lpi26sc1a = 0.25.
IF (lpi27an1 = -2) lpi27sc1a = 0.25.
IF (lpi28an1 = -2) lpi28sc1a = 0.25.
IF (lpi29an1 = -2) lpi29sc1a = 0.25.
IF (lpi30an1 = -2) lpi30sc1a = 0.25.
IF (lpi31an1 = -2) lpi31sc1a = 0.25.
IF (lpi32an1 = -2) lpi32sc1a = 0.25.
IF (lpi33an1 = -2) lpi33sc1a = 0.25.
IF (lpi34an1 = -2) lpi34sc1a = 0.25.
IF (lpi35an1 = -2) lpi35sc1a = 0.25.
IF (lpi36an1 = -2) lpi36sc1a = 0.25.
IF (lpi37an1 = -2) lpi37sc1a = 0.25.
IF (lpi38an1 = -2) lpi38sc1a = 0.25.
IF (lpi39an1 = -2) lpi39sc1a = 0.25.
IF (lpi40an1 = -2) lpi40sc1a = 0.25.
IF (lpi41an1 = -2) lpi41sc1a = 0.25.
IF (lpi42an1 = -2) lpi42sc1a = 0.25.
IF (lpi43an1 = -2) lpi43sc1a = 0.25.
IF (lpi44an1 = -2) lpi44sc1a = 0.25.
IF (lpi45an1 = -2) lpi45sc1a = 0.25.
IF (lpi46an1 = -2) lpi46sc1a = 0.25.
IF (lpi47an1 = -2) lpi47sc1a = 0.25.
IF (lpi48an1 = -2) lpi48sc1a = 0.25.
IF (lpi49an1 = -2) lpi49sc1a = 0.25.
IF (lpi50an1 = -2) lpi50sc1a = 0.25.
IF (lpi51an1 = -2) lpi51sc1a = 0.25.
IF (lpi52an1 = -2) lpi52sc1a = 0.25.
IF (lpi53an1 = -2) lpi53sc1a = 0.25.
IF (lpi54an1 = -2) lpi54sc1a = 0.25.
IF (lpi55an1 = -2) lpi55sc1a = 0.25.
IF (lpi56an1 = -2) lpi56sc1a = 0.25.
IF (lpi57an1 = -2) lpi57sc1a = 0.25.
IF (lpi58an1 = -2) lpi58sc1a = 0.25.
IF (lpi59an1 = -2) lpi59sc1a = 0.25.
IF (lpi60an1 = -2) lpi60sc1a = 0.25.
IF (lpi61an1 = -2) lpi61sc1a = 0.25.
IF (lpi62an1 = -2) lpi62sc1a = 0.25.
IF (lpi63an1 = -2) lpi63sc1a = 0.25.
IF (lpi64an1 = -2) lpi64sc1a = 0.25.
IF (lpi65an1 = -2) lpi65sc1a = 0.25.
IF (lpi66an1 = -2) lpi66sc1a = 0.25.
IF (lpi67an1 = -2) lpi67sc1a = 0.25.
IF (lpi68an1 = -2) lpi68sc1a = 0.25.
IF (lpi69an1 = -2) lpi69sc1a = 0.25.
IF (lpi70an1 = -2) lpi70sc1a = 0.25.
IF (lpi71an1 = -2) lpi71sc1a = 0.25.
IF (lpi72an1 = -2) lpi72sc1a = 0.25.
IF (lpi73an1 = -2) lpi73sc1a = 0.25.
IF (lpi74an1 = -2) lpi74sc1a = 0.25.
IF (lpi75an1 = -2) lpi75sc1a = 0.25.
IF (lpi76an1 = -2) lpi76sc1a = 0.25.
IF (lpi77an1 = -2) lpi77sc1a = 0.25.
IF (lpi78an1 = -2) lpi78sc1a = 0.25.
IF (lpi79an1 = -2) lpi79sc1a = 0.25.
IF (lpi80an1 = -2) lpi80sc1a = 0.25.
IF (lpi81an1 = -2) lpi81sc1a = 0.25.
IF (lpi82an1 = -2) lpi82sc1a = 0.25.
IF (lpi83an1 = -2) lpi83sc1a = 0.25.
IF (lpi84an1 = -2) lpi84sc1a = 0.25.
IF (lpi85an1 = -2) lpi85sc1a = 0.25.
IF (lpi86an1 = -2) lpi86sc1a = 0.25.
IF (lpi87an1 = -2) lpi87sc1a = 0.25.
IF (lpi88an1 = -2) lpi88sc1a = 0.25.
IF (lpi89an1 = -2) lpi89sc1a = 0.25.
IF (lpi90an1 = -2) lpi90sc1a = 0.25.
IF (lpi91an1 = -2) lpi91sc1a = 0.25.
IF (lpi92an1 = -2) lpi92sc1a = 0.25.
IF (lpi93an1 = -2) lpi93sc1a = 0.25.
IF (lpi94an1 = -2) lpi94sc1a = 0.25.
IF (lpi95an1 = -2) lpi95sc1a = 0.25.
IF (lpi96an1 = -2) lpi96sc1a = 0.25.
IF (lpi97an1 = -2) lpi97sc1a = 0.25.
IF (lpi98an1 = -2) lpi98sc1a = 0.25.
IF (lpi99an1 = -2) lpi99sc1a = 0.25.
IF (lpi100an1 = -2) lpi100sc1a = 0.25.
EXECUTE.

* Compute total score out of 82 using original items 19-22.
* plus the new adjusted items 23-100.
COMPUTE lpitota1 = SUM(lpi19sc1, lpi20sc1, lpi21sc1, lpi22sc1,
 lpi23sc1a, lpi24sc1a, lpi25sc1a, lpi26sc1a, lpi27sc1a, lpi28sc1a, lpi29sc1a,
 lpi30sc1a, lpi31sc1a, lpi32sc1a, lpi33sc1a, lpi34sc1a, lpi35sc1a, lpi36sc1a,
 lpi37sc1a, lpi38sc1a, lpi39sc1a, lpi40sc1a, lpi41sc1a, lpi42sc1a, lpi43sc1a,
 lpi44sc1a, lpi45sc1a, lpi46sc1a, lpi47sc1a, lpi48sc1a, lpi49sc1a, lpi50sc1a,
 lpi51sc1a, lpi52sc1a, lpi53sc1a, lpi54sc1a, lpi55sc1a, lpi56sc1a, lpi57sc1a,
 lpi58sc1a, lpi59sc1a, lpi60sc1a, lpi61sc1a, lpi62sc1a, lpi63sc1a, lpi64sc1a,
 lpi65sc1a, lpi66sc1a, lpi67sc1a, lpi68sc1a, lpi69sc1a, lpi70sc1a, lpi71sc1a,
 lpi72sc1a, lpi73sc1a, lpi74sc1a, lpi75sc1a, lpi76sc1a, lpi77sc1a, lpi78sc1a,
 lpi79sc1a, lpi80sc1a, lpi81sc1a, lpi82sc1a, lpi83sc1a, lpi84sc1a, lpi85sc1a,
 lpi86sc1a, lpi87sc1a, lpi88sc1a, lpi89sc1a, lpi90sc1a, lpi91sc1a, lpi92sc1a,
 lpi93sc1a, lpi94sc1a, lpi95sc1a, lpi96sc1a, lpi97sc1a, lpi98sc1a, lpi99sc1a,
 lpi100sc1a).
EXECUTE.
lpmfq1/2

See lcmfq1/2, lpmfq1/2 above.

lpnart1/2, ltnart1/2

APSD Narcissism scales.
Parent (lp) and teacher (lt) versions.
Total scores with range 0-14.
Each is derived from 7 APSD items, requiring at least 4 of the items to be non-missing.
The scales are computed as variables with names ending in 1 in the syntax below; these were later copied into co-twin variables with names ending in 2 on double entry.

* 7 items, require at least 4 of them for each scale.
COMPUTE lpnart1 = 7 * MEAN.4(lpaps051,lpaps081,
 lpaps101,lpaps111,lpaps141,lpaps151,lpaps161).
COMPUTE ltnart1 = 7 * MEAN.4(ltaps051,ltaps081,
 ltaps101,ltaps111,ltaps141,ltaps151,ltaps161).
EXECUTE.
lpncage

Age of twin (in decimal years) when the parent NC levels questionnaire was returned.
Derived from the return date (lpncdate) and the birth date of the twins (aonsdob). These date variables are not retained in the dataset.

* Age when parent NC levels were returned.
COMPUTE lpncage = RND((DATEDIFF(lpncdate, aonsdob, "days")) / 365.25, 0.1).
EXECUTE.
lpncLLCage, lpncLLCdate

See lcqLLCage1/2, etc above.

lpparnegt1/2, lpparpost1/2, lppart1/2

See lcparnegt1/2, etc above.

lpqage

Age of twin (in decimal years) when the parent booklet was returned.
Derived from the return date of the parent booklet (lprdate) or, if this is missing, the return date of the SRS CAST questionnaire (lsrsdate); and the birth date of the twins (aonsdob). These date variables are not retained in the dataset.

* Parent questionnaire date is missing in some cases, try to fill gaps.
* Use date when parent questionnaire returned, if available.
COMPUTE lpqdate = lprdate.
EXECUTE.
* Where missing, use the SRS CAST questionnaire return date, if known.
IF (SYSMIS(lprdate)) lpqdate = lsrsdate.
EXECUTE.
* Still missing for 20 SRS pairs, but no other dates available to go on.
* Now subtract birth date from activity dates and convert to age in decimal years.
COMPUTE lpqage = RND((DATEDIFF(lpqdate, aonsdob, "days")) / 365.25, 0.1).
EXECUTE.
lpqLLCage, lpqLLCdate

See lcqLLCage1/2, etc above.

lpsdqbeht1/2

See lcsdqbeht1/2, etc above.

lpsdqcont1/2

See lcsdqcont1/2, etc above.

lpsdqemot1/2

See lcsdqemot1/2, etc above.

lpsdqhypt1/2

See lcsdqhypt1/2, etc above.

lpsdqpert1/2

See lcsdqpert1/2, etc above.

lpsdqprot1/2

See lcsdqprot1/2, etc above.

lpubtot1/2

Twin puberty scale.
Derived from puberty items in the twin booklet.
Note that the scale is derived in different ways for males and females, because some items differed for the two sexes.
Computed as lpubtot1 in the syntax below, then copied into variable lpubtot2 on double entry.

* From self-reported items in the twin booklet.
* First recode into temporary variables.
* Recode values 0-3 into values 1-4, and 4 (not sure) into missing.
RECODE lcpub11 lcpub21 lcpub31 lcpub41 lcpub61 lcpub71
 (0=1) (1=2) (2=3) (3=4) (ELSE=SYSMIS)
INTO pub11 pub21 pub31 pub41 pub61 pub71.
EXECUTE.
* Item 5 only has values 0 and 1.
* Recode these to 1 and 4 so the range of values.
* is comparable with the other items.
RECODE lcpub51 
 (0=1) (1=4) (ELSE=SYSMIS)
INTO pub51 .
EXECUTE.

* Items 1-3 are common to both sexes, but items 4-5 are for.
* girls and items 6-7 are for boys.
* Use simply MEAN so a minimum of only one of the five items.
* is required for the scale.
DO IF (sex1 = 0).
  COMPUTE lpubtot1 = MEAN(pub11, pub21, pub31, pub41, pub51).
ELSE IF (sex1 = 1).
  COMPUTE lpubtot1 = MEAN(pub11, pub21, pub31, pub61, pub71).
END IF.
EXECUTE.
* Note that the filter uses sex1 (admin data) not lcsex1 (puberty qnr).
* so rare cases where these disagree will not use the sex-specific items.
lqnatm1/2

Mean item answer time (in seconds) for the twin web Maths and Reading Questionnaire.
Computed as lqnatm1 in the syntax below, and later copied to variable lqnatm2 on double entry.

COMPUTE lqnatm1 = MEAN(lqcomat1,lqnewat1,lqtvhat1,lqbksat1,lqtlkat1,
 lqma1at1,lqma2at1,lqma3at1,lqma4at1,lqma5at1,lqr01at1,lqr02at1,
 lqr03at1,lqr04at1,lqr05at1,lqartat1,lqr06at1,lqr07at1,lqr08at1,lqr09at1,
 lqr10at1,lqr11at1,lqr12at1,lqr13at1,lqr14at1,lqr15at1,lqr16at1,lqr17at1).
lrvatm1/2

Mean item answer time (in seconds) for the twin Raven web test.
Computed as lrvatm1 in the syntax below, and later copied to variable lrvatm2 on double entry.

COMPUTE lrvatm1 = MEAN(lrc01at1,lrc03at1,lrc05at1,
  lrc07at1,lrc09at1,lrc11at1,
  lrd01at1,lrd03at1,lrd05at1,lrd07at1,lrd09at1,lrd11at1,lre01at1, 
  lre03at1,lre05at1,lre07at1,lre09at1,lre11at1,lrf01at1,
  lrf03at1,lrf05at1,lrf07at1,lrf09at1,lrf11at1).
lrvtota1/2

Adjusted version of the total score for the Ravens web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, can discontinue items 7, 9 and 11 within each subtest.
* Copy existing item scores into temporary variables.
RECODE lrc07sc1 lrc09sc1 lrc11sc1 lrd07sc1 lrd09sc1 lrd11sc1 
 lre07sc1 lre09sc1 lre11sc1 lrf07sc1 lrf09sc1 lrf11sc1
 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lrc07sc1a lrc09sc1a lrc11sc1a lrd07sc1a lrd09sc1a lrd11sc1a 
 lre07sc1a lre09sc1a lre11sc1a lrf07sc1a lrf09sc1a lrf11sc1a .
EXECUTE.
* Where discontinued, replace score of 0 with score of 0.125.
* (each item has 8 possible responses, so chance score is 1/8).
IF (lrc07an1 = -2) lrc07sc1a = 0.125.
IF (lrc09an1 = -2) lrc09sc1a = 0.125.
IF (lrc11an1 = -2) lrc11sc1a = 0.125.
IF (lrd07an1 = -2) lrd07sc1a = 0.125.
IF (lrd09an1 = -2) lrd09sc1a = 0.125.
IF (lrd11an1 = -2) lrd11sc1a = 0.125.
IF (lre07an1 = -2) lre07sc1a = 0.125.
IF (lre09an1 = -2) lre09sc1a = 0.125.
IF (lre11an1 = -2) lre11sc1a = 0.125.
IF (lrf07an1 = -2) lrf07sc1a = 0.125.
IF (lrf09an1 = -2) lrf09sc1a = 0.125.
IF (lrf11an1 = -2) lrf11sc1a = 0.125.
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE lrvtota1 = SUM(lrc01sc1, lrc03sc1, lrc05sc1, lrc07sc1a,
 lrc09sc1a, lrc11sc1a, lrd01sc1, lrd03sc1, lrd05sc1, lrd07sc1a,
 lrd09sc1a, lrd11sc1a, lre01sc1, lre03sc1, lre05sc1, lre07sc1a,
 lre09sc1a, lre11sc1a, lrf01sc1, lrf03sc1, lrf05sc1, lrf07sc1a,
 lrf09sc1a, lrf11sc1a).
EXECUTE.
lt2a1/2, lt3a1/2, lte1/2, ltm1/2, lts1/2

Academic achievement scales, from teacher-reported National Curriculum levels.
There are scales for achievement in English (lte1/2), mathematics (ltm1/2) and science (lts1/2); also overall achievement scales for all three subjects (lt3a1/2), and for the two subjects English and mathematics (lt2a1/2).
Each scale is derived as an equally weighted mean of the relevant standardised teacher rating items.

* First filter out all the standard twin exclusions.
* (medical, perinatal, unknown sex/zyg, missing 1st Contact).
* This will affect all standardised variables derived below.
USE ALL.
COMPUTE filter_$=(exclude1 = 0).
VARIABLE LABELS filter_$ 'exclude1 = 0 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

* First standardise the required component variables.
DESCRIPTIVES
  VARIABLES= ltengre1 ltengsp1 ltengwr1 ltmatha1 ltmatnu1
 ltmatsh1 ltmatus1 ltscili1 ltscima1 ltsciph1 ltscisc1 /SAVE .

* Academic achievement composites.
* Derived from teacher NC ratings in the teacher booklet.
* Require all component items to be non-missing.

* English, maths and science.
COMPUTE te1 = MEAN.3(Zltengre1, Zltengsp1, Zltengwr1).
COMPUTE tm1 = MEAN.4(Zltmatha1, Zltmatnu1, Zltmatsh1, Zltmatus1).
COMPUTE ts1 = MEAN.4(Zltscili1, Zltscima1, Zltsciph1, Zltscisc1).
EXECUTE.
* Overall 2-subject and 3-subject composites.
COMPUTE t2a1 = MEAN.7(Zltengre1, Zltengsp1, Zltengwr1,
 Zltmatha1, Zltmatnu1, Zltmatsh1, Zltmatus1).
COMPUTE t3a1 = MEAN.11(Zltengre1, Zltengsp1, Zltengwr1,
 Zltmatha1, Zltmatnu1, Zltmatsh1, Zltmatus1, Zltscili1,
 Zltscima1, Zltsciph1, Zltscisc1).
EXECUTE.
* Standardise the new variables.
DESCRIPTIVES
  VARIABLES= te1 (lte1) tm1 (ltm1) ts1 (lts1) t2a1 (lt2a1) t3a1 (lt3a1)
 /SAVE .

* Standardisations finished - remove filter.
FILTER OFF.
USE ALL.
EXECUTE.
lt2ac1/2, lt3ac1/2

See lp2ac1/2, etc above.

ltapsdt1/2

See lpapsdt1/2, ltapsdt1/2 above.

ltcacot1/2

See lpcacot1/2, ltcacot1/2 above.

ltcalt1/2

See lpcalt1/2, ltcalt1/2 above.

ltcanot1/2

See lpcanot1/2, ltcanot1/2 above.

ltcasot1/2

See lpcasot1/2, ltcasot1/2 above.

ltcastt1/2

See lpcastt1/2, ltcastt1/2 above.

lteng1/2

See lp2ac1/2, etc above.

ltimpt1/2

See lpimpt1/2, ltimpt1/2 above.

ltmat1/2

See lp2ac1/2, etc above.

ltnart1/2

See lpnart1/2, ltnart1/2 above.

ltoatm1/2

Mean item answer time (in seconds) for the twin TOAL web test.
Computed as ltoatm1 in the syntax below, and later copied to variable ltoatm2 on double entry.

COMPUTE ltoatm1 = MEAN(ltop1at1,lto01at1,lto02at1,
 lto03at1,lto04at1,lto05at1,lto06at1,lto07at1,lto08at1,
 lto09at1,lto10at1,lto11at1,lto12at1,lto13at1,lto14at1,lto15at1,lto16at1,
 lto17at1,lto18at1,lto19at1,lto20at1,lto21at1,lto22at1,lto23at1,lto24at1,
 lto25at1,lto26at1,lto27at1,lto28at1,lto29at1,lto30at1,lto31at1,lto32at1,
 lto33at1,lto34at1,lto35at1).
ltobasal1/2, ltoceiling1/2

Position of the 'basal' and 'ceiling' points in the TOAL web test, used in the derivation of the test total score (ltotot1/2, described elsewhere on this page). These variables are derived from the test item scores, using the rules outlined below (and further described in the syntax).
The basal is defined as a sequence of 5 consecutive correctly answered items; in the syntax below, the basal point is defined as the item number of the lowest of those 5 items. If more than one such sequence exists in the test, we use the highest in terms of item number. If no such sequence exists, by default the basal point is defined as item 1.
The ceiling is defined as a set of 3 incorrectly-answered items within any sequence of 5 consecutively-answered and consecutively-numbered items; in the syntax below, the ceiling point is defined as the item number of the highest item in the sequence. If no such sequence exists, by default the ceiling point is defined as item 35 (the final item).
An additional rule states that the ceiling may not include items 6 to 9 if (because of branching rules) they are attempted in reverse order.
Branching starts with the practice item p1; if answered incorrectly, items 1 to 35 are attempted in ascending order and the test is discontinued once a ceiling (or item 35) is reached; hence only one ceiling may exist. However, if practice item p1 is answered correctly, items 1 to 9 are initially skipped and items 10 to 35 are attempted in ascending order; but if a ceiling is reached before item 35 then items 1 to 9 are attempted in descending order until another ceiling (or item 1) is reached; hence two ceilings may exist, and the rules dictate that the lower of the two ceilings should be used.

* Default basal point is 1; default ceiling is item 35.
COMPUTE ltobasal1 = 1.
COMPUTE ltoceiling1 = 35.
EXECUTE.

* Branching with practice item correct.
* ------------------------------------.
* Step up from item 10 until ceiling is reached.
* A ceiling comprises 5 (or fewer) consecutively-numbered and consecutively-answered.
* items containing 3 or more incorrect responses.
* Only need check sequences of fewer than 5 items directly after item 10.
* Define ceiling as the highest of the items in the sequence.
* Stop checking higher items once a ceiling is detected.
* and treat missing scores as if zero (in crashed items).
* Default ceiling is 35 (last item); upward sequence of item stops.
* on reaching ceiling (but see below for what happens next).
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto10sc1, lto11sc1, lto12sc1) = 0) ltoceiling1 = 12.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto10sc1, lto11sc1, lto12sc1, lto13sc1) < 2) ltoceiling1 = 13.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto10sc1, lto11sc1, lto12sc1, lto13sc1, lto14sc1) < 3) ltoceiling1 = 14.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto11sc1, lto12sc1, lto13sc1, lto14sc1, lto15sc1) < 3) ltoceiling1 = 15.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto12sc1, lto13sc1, lto14sc1, lto15sc1, lto16sc1) < 3) ltoceiling1 = 16.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto13sc1, lto14sc1, lto15sc1, lto16sc1, lto17sc1) < 3) ltoceiling1 = 17.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto14sc1, lto15sc1, lto16sc1, lto17sc1, lto18sc1) < 3) ltoceiling1 = 18.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto15sc1, lto16sc1, lto17sc1, lto18sc1, lto19sc1) < 3) ltoceiling1 = 19.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto16sc1, lto17sc1, lto18sc1, lto19sc1, lto20sc1) < 3) ltoceiling1 = 20.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto17sc1, lto18sc1, lto19sc1, lto20sc1, lto21sc1) < 3) ltoceiling1 = 21.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto18sc1, lto19sc1, lto20sc1, lto21sc1, lto22sc1) < 3) ltoceiling1 = 22.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto19sc1, lto20sc1, lto21sc1, lto22sc1, lto23sc1) < 3) ltoceiling1 = 23.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto20sc1, lto21sc1, lto22sc1, lto23sc1, lto24sc1) < 3) ltoceiling1 = 24.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto21sc1, lto22sc1, lto23sc1, lto24sc1, lto25sc1) < 3) ltoceiling1 = 25.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto22sc1, lto23sc1, lto24sc1, lto25sc1, lto26sc1) < 3) ltoceiling1 = 26.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto23sc1, lto24sc1, lto25sc1, lto26sc1, lto27sc1) < 3) ltoceiling1 = 27.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto24sc1, lto25sc1, lto26sc1, lto27sc1, lto28sc1) < 3) ltoceiling1 = 28.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto25sc1, lto26sc1, lto27sc1, lto28sc1, lto29sc1) < 3) ltoceiling1 = 29.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto26sc1, lto27sc1, lto28sc1, lto29sc1, lto30sc1) < 3) ltoceiling1 = 30.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto27sc1, lto28sc1, lto29sc1, lto30sc1, lto31sc1) < 3) ltoceiling1 = 31.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto28sc1, lto29sc1, lto30sc1, lto31sc1, lto32sc1) < 3) ltoceiling1 = 32.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto29sc1, lto30sc1, lto31sc1, lto32sc1, lto33sc1) < 3) ltoceiling1 = 33.
IF (ltop1sc1 = 1 & ltoceiling1 = 35 & SUM(lto30sc1, lto31sc1, lto32sc1, lto33sc1, lto34sc1) < 3) ltoceiling1 = 34.
EXECUTE.
* Now check for a basal, detected as 5 consecutive correct items.
* Define basal point as the lowest of the 5 items in the sequence.
* but only check below the ceiling (should not be a basal above a ceiling).
* (note that if more than one such sequence exists, we use the higher, so must check in ascending order).
IF (ltop1sc1 = 1 & ltoceiling1 > 10 & SUM(lto10sc1, lto11sc1, lto12sc1, lto13sc1, lto14sc1) = 5) ltobasal1 = 10.
IF (ltop1sc1 = 1 & ltoceiling1 > 11 & SUM(lto11sc1, lto12sc1, lto13sc1, lto14sc1, lto15sc1) = 5) ltobasal1 = 11.
IF (ltop1sc1 = 1 & ltoceiling1 > 12 & SUM(lto12sc1, lto13sc1, lto14sc1, lto15sc1, lto16sc1) = 5) ltobasal1 = 12.
IF (ltop1sc1 = 1 & ltoceiling1 > 13 & SUM(lto13sc1, lto14sc1, lto15sc1, lto16sc1, lto17sc1) = 5) ltobasal1 = 13.
IF (ltop1sc1 = 1 & ltoceiling1 > 14 & SUM(lto14sc1, lto15sc1, lto16sc1, lto17sc1, lto18sc1) = 5) ltobasal1 = 14.
IF (ltop1sc1 = 1 & ltoceiling1 > 15 & SUM(lto15sc1, lto16sc1, lto17sc1, lto18sc1, lto19sc1) = 5) ltobasal1 = 15.
IF (ltop1sc1 = 1 & ltoceiling1 > 16 & SUM(lto16sc1, lto17sc1, lto18sc1, lto19sc1, lto20sc1) = 5) ltobasal1 = 16.
IF (ltop1sc1 = 1 & ltoceiling1 > 17 & SUM(lto17sc1, lto18sc1, lto19sc1, lto20sc1, lto21sc1) = 5) ltobasal1 = 17.
IF (ltop1sc1 = 1 & ltoceiling1 > 18 & SUM(lto18sc1, lto19sc1, lto20sc1, lto21sc1, lto22sc1) = 5) ltobasal1 = 18.
IF (ltop1sc1 = 1 & ltoceiling1 > 19 & SUM(lto19sc1, lto20sc1, lto21sc1, lto22sc1, lto23sc1) = 5) ltobasal1 = 19.
IF (ltop1sc1 = 1 & ltoceiling1 > 20 & SUM(lto20sc1, lto21sc1, lto22sc1, lto23sc1, lto24sc1) = 5) ltobasal1 = 20.
IF (ltop1sc1 = 1 & ltoceiling1 > 21 & SUM(lto21sc1, lto22sc1, lto23sc1, lto24sc1, lto25sc1) = 5) ltobasal1 = 21.
IF (ltop1sc1 = 1 & ltoceiling1 > 22 & SUM(lto22sc1, lto23sc1, lto24sc1, lto25sc1, lto26sc1) = 5) ltobasal1 = 22.
IF (ltop1sc1 = 1 & ltoceiling1 > 23 & SUM(lto23sc1, lto24sc1, lto25sc1, lto26sc1, lto27sc1) = 5) ltobasal1 = 23.
IF (ltop1sc1 = 1 & ltoceiling1 > 24 & SUM(lto24sc1, lto25sc1, lto26sc1, lto27sc1, lto28sc1) = 5) ltobasal1 = 24.
IF (ltop1sc1 = 1 & ltoceiling1 > 25 & SUM(lto25sc1, lto26sc1, lto27sc1, lto28sc1, lto29sc1) = 5) ltobasal1 = 25.
IF (ltop1sc1 = 1 & ltoceiling1 > 26 & SUM(lto26sc1, lto27sc1, lto28sc1, lto29sc1, lto30sc1) = 5) ltobasal1 = 26.
IF (ltop1sc1 = 1 & ltoceiling1 > 27 & SUM(lto27sc1, lto28sc1, lto29sc1, lto30sc1, lto31sc1) = 5) ltobasal1 = 27.
IF (ltop1sc1 = 1 & ltoceiling1 > 28 & SUM(lto28sc1, lto29sc1, lto30sc1, lto31sc1, lto32sc1) = 5) ltobasal1 = 28.
IF (ltop1sc1 = 1 & ltoceiling1 > 29 & SUM(lto29sc1, lto30sc1, lto31sc1, lto32sc1, lto33sc1) = 5) ltobasal1 = 29.
IF (ltop1sc1 = 1 & ltoceiling1 > 30 & SUM(lto30sc1, lto31sc1, lto32sc1, lto33sc1, lto34sc1) = 5) ltobasal1 = 30.
IF (ltop1sc1 = 1 & ltoceiling1 > 31 & SUM(lto31sc1, lto32sc1, lto33sc1, lto34sc1, lto35sc1) = 5) ltobasal1 = 31.
EXECUTE.

* Now if no basal is yet established (other than default of item 1).
* items 1 to 9 are attempted in reverse order to try to get a basal.
* Note that basal can be a sequence like 8/9/10/11/12.
* including some items above 10 and some items below 10.
* We require the highest such sequence, so at each step check whether.
* a higher basal point already reached.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto09sc1, lto10sc1, lto11sc1, lto12sc1, lto13sc1) = 5) ltobasal1 = 9.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto08sc1, lto09sc1, lto10sc1, lto11sc1, lto12sc1) = 5) ltobasal1 = 8.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto07sc1, lto08sc1, lto09sc1, lto10sc1, lto11sc1) = 5) ltobasal1 = 7.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto06sc1, lto07sc1, lto08sc1, lto09sc1, lto10sc1) = 5) ltobasal1 = 6.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto05sc1, lto06sc1, lto07sc1, lto08sc1, lto09sc1) = 5) ltobasal1 = 5.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto04sc1, lto05sc1, lto06sc1, lto07sc1, lto08sc1) = 5) ltobasal1 = 4.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto03sc1, lto04sc1, lto05sc1, lto06sc1, lto07sc1) = 5) ltobasal1 = 3.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto02sc1, lto03sc1, lto04sc1, lto05sc1, lto06sc1) = 5) ltobasal1 = 2.
EXECUTE.

* According to rules, after branching down as above, if no basal.
* is yet established above the default of item 1, then.
* can have a second ceiling in items 1-5.
* (but cannot have a ceiling in items 6-9 if attempted in reverse order).
* This ceiling replaces the higher ceiling above item 10.
IF (ltop1sc1 = 1 & ltobasal1 = 1 & SUM(lto01sc1, lto02sc1, lto03sc1, lto04sc1, lto05sc1) < 3) ltoceiling1 = 5.
EXECUTE.

* Branching with practice item wrong.
* ----------------------------------.
* If item p1 score is zero.
* then twin should attempt items in ascending numeric order until ceiling reached.
* without further branching.
* As above, step up from item 1 until ceiling is reached.
* detected as 3 or more incorrect in a sequence of 5 consecutive items.
* Note that items 1-5 are obligatory under these circumstances, cannot have ceiling after item 3 or 4.
* Define ceiling as the highest of the 5 items in the sequence.
* Stop checking higher items once a ceiling is detected (test should discontinue).
* and treat missing scores as if zero.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto01sc1, lto02sc1, lto03sc1, lto04sc1, lto05sc1) < 3) ltoceiling1 = 5.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto02sc1, lto03sc1, lto04sc1, lto05sc1, lto06sc1) < 3) ltoceiling1 = 6.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto03sc1, lto04sc1, lto05sc1, lto06sc1, lto07sc1) < 3) ltoceiling1 = 7.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto04sc1, lto05sc1, lto06sc1, lto07sc1, lto08sc1) < 3) ltoceiling1 = 8.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto05sc1, lto06sc1, lto07sc1, lto08sc1, lto09sc1) < 3) ltoceiling1 = 9.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto06sc1, lto07sc1, lto08sc1, lto09sc1, lto10sc1) < 3) ltoceiling1 = 10.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto07sc1, lto08sc1, lto09sc1, lto10sc1, lto11sc1) < 3) ltoceiling1 = 11.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto08sc1, lto09sc1, lto10sc1, lto11sc1, lto12sc1) < 3) ltoceiling1 = 12.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto09sc1, lto10sc1, lto11sc1, lto12sc1, lto13sc1) < 3) ltoceiling1 = 13.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto10sc1, lto11sc1, lto12sc1, lto13sc1, lto14sc1) < 3) ltoceiling1 = 14.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto11sc1, lto12sc1, lto13sc1, lto14sc1, lto15sc1) < 3) ltoceiling1 = 15.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto12sc1, lto13sc1, lto14sc1, lto15sc1, lto16sc1) < 3) ltoceiling1 = 16.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto13sc1, lto14sc1, lto15sc1, lto16sc1, lto17sc1) < 3) ltoceiling1 = 17.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto14sc1, lto15sc1, lto16sc1, lto17sc1, lto18sc1) < 3) ltoceiling1 = 18.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto15sc1, lto16sc1, lto17sc1, lto18sc1, lto19sc1) < 3) ltoceiling1 = 19.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto16sc1, lto17sc1, lto18sc1, lto19sc1, lto20sc1) < 3) ltoceiling1 = 20.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto17sc1, lto18sc1, lto19sc1, lto20sc1, lto21sc1) < 3) ltoceiling1 = 21.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto18sc1, lto19sc1, lto20sc1, lto21sc1, lto22sc1) < 3) ltoceiling1 = 22.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto19sc1, lto20sc1, lto21sc1, lto22sc1, lto23sc1) < 3) ltoceiling1 = 23.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto20sc1, lto21sc1, lto22sc1, lto23sc1, lto24sc1) < 3) ltoceiling1 = 24.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto21sc1, lto22sc1, lto23sc1, lto24sc1, lto25sc1) < 3) ltoceiling1 = 25.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto22sc1, lto23sc1, lto24sc1, lto25sc1, lto26sc1) < 3) ltoceiling1 = 26.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto23sc1, lto24sc1, lto25sc1, lto26sc1, lto27sc1) < 3) ltoceiling1 = 27.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto24sc1, lto25sc1, lto26sc1, lto27sc1, lto28sc1) < 3) ltoceiling1 = 28.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto25sc1, lto26sc1, lto27sc1, lto28sc1, lto29sc1) < 3) ltoceiling1 = 29.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto26sc1, lto27sc1, lto28sc1, lto29sc1, lto30sc1) < 3) ltoceiling1 = 30.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto27sc1, lto28sc1, lto29sc1, lto30sc1, lto31sc1) < 3) ltoceiling1 = 31.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto28sc1, lto29sc1, lto30sc1, lto31sc1, lto32sc1) < 3) ltoceiling1 = 32.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto29sc1, lto30sc1, lto31sc1, lto32sc1, lto33sc1) < 3) ltoceiling1 = 33.
IF (ltop1sc1 = 0 & ltoceiling1 = 35 & SUM(lto30sc1, lto31sc1, lto32sc1, lto33sc1, lto34sc1) < 3) ltoceiling1 = 34.
EXECUTE.

* Now check for a basal; as above, 5 consecutive correct items.
* with basal point as the lowest of the 5 items in the sequence.
* but only check below the ceiling (should not be a basal above a ceiling).
* (note that if more than one such sequence exists, we use the higher, so must check in ascending order).
IF (ltop1sc1 = 0 & ltoceiling1 > 1 & SUM(lto01sc1, lto02sc1, lto03sc1, lto04sc1, lto05sc1) = 5) ltobasal1 = 1.
IF (ltop1sc1 = 0 & ltoceiling1 > 2 & SUM(lto02sc1, lto03sc1, lto04sc1, lto05sc1, lto06sc1) = 5) ltobasal1 = 2.
IF (ltop1sc1 = 0 & ltoceiling1 > 3 & SUM(lto03sc1, lto04sc1, lto05sc1, lto06sc1, lto07sc1) = 5) ltobasal1 = 3.
IF (ltop1sc1 = 0 & ltoceiling1 > 4 & SUM(lto04sc1, lto05sc1, lto06sc1, lto07sc1, lto08sc1) = 5) ltobasal1 = 4.
IF (ltop1sc1 = 0 & ltoceiling1 > 5 & SUM(lto05sc1, lto06sc1, lto07sc1, lto08sc1, lto09sc1) = 5) ltobasal1 = 5.
IF (ltop1sc1 = 0 & ltoceiling1 > 6 & SUM(lto06sc1, lto07sc1, lto08sc1, lto09sc1, lto10sc1) = 5) ltobasal1 = 6.
IF (ltop1sc1 = 0 & ltoceiling1 > 7 & SUM(lto07sc1, lto08sc1, lto09sc1, lto10sc1, lto11sc1) = 5) ltobasal1 = 7.
IF (ltop1sc1 = 0 & ltoceiling1 > 8 & SUM(lto08sc1, lto09sc1, lto10sc1, lto11sc1, lto12sc1) = 5) ltobasal1 = 8.
IF (ltop1sc1 = 0 & ltoceiling1 > 9 & SUM(lto09sc1, lto10sc1, lto11sc1, lto12sc1, lto13sc1) = 5) ltobasal1 = 9.
IF (ltop1sc1 = 0 & ltoceiling1 > 10 & SUM(lto10sc1, lto11sc1, lto12sc1, lto13sc1, lto14sc1) = 5) ltobasal1 = 10.
IF (ltop1sc1 = 0 & ltoceiling1 > 11 & SUM(lto11sc1, lto12sc1, lto13sc1, lto14sc1, lto15sc1) = 5) ltobasal1 = 11.
IF (ltop1sc1 = 0 & ltoceiling1 > 12 & SUM(lto12sc1, lto13sc1, lto14sc1, lto15sc1, lto16sc1) = 5) ltobasal1 = 12.
IF (ltop1sc1 = 0 & ltoceiling1 > 13 & SUM(lto13sc1, lto14sc1, lto15sc1, lto16sc1, lto17sc1) = 5) ltobasal1 = 13.
IF (ltop1sc1 = 0 & ltoceiling1 > 14 & SUM(lto14sc1, lto15sc1, lto16sc1, lto17sc1, lto18sc1) = 5) ltobasal1 = 14.
IF (ltop1sc1 = 0 & ltoceiling1 > 15 & SUM(lto15sc1, lto16sc1, lto17sc1, lto18sc1, lto19sc1) = 5) ltobasal1 = 15.
IF (ltop1sc1 = 0 & ltoceiling1 > 16 & SUM(lto16sc1, lto17sc1, lto18sc1, lto19sc1, lto20sc1) = 5) ltobasal1 = 16.
IF (ltop1sc1 = 0 & ltoceiling1 > 17 & SUM(lto17sc1, lto18sc1, lto19sc1, lto20sc1, lto21sc1) = 5) ltobasal1 = 17.
IF (ltop1sc1 = 0 & ltoceiling1 > 18 & SUM(lto18sc1, lto19sc1, lto20sc1, lto21sc1, lto22sc1) = 5) ltobasal1 = 18.
IF (ltop1sc1 = 0 & ltoceiling1 > 19 & SUM(lto19sc1, lto20sc1, lto21sc1, lto22sc1, lto23sc1) = 5) ltobasal1 = 19.
IF (ltop1sc1 = 0 & ltoceiling1 > 20 & SUM(lto20sc1, lto21sc1, lto22sc1, lto23sc1, lto24sc1) = 5) ltobasal1 = 20.
IF (ltop1sc1 = 0 & ltoceiling1 > 21 & SUM(lto21sc1, lto22sc1, lto23sc1, lto24sc1, lto25sc1) = 5) ltobasal1 = 21.
IF (ltop1sc1 = 0 & ltoceiling1 > 22 & SUM(lto22sc1, lto23sc1, lto24sc1, lto25sc1, lto26sc1) = 5) ltobasal1 = 22.
IF (ltop1sc1 = 0 & ltoceiling1 > 23 & SUM(lto23sc1, lto24sc1, lto25sc1, lto26sc1, lto27sc1) = 5) ltobasal1 = 23.
IF (ltop1sc1 = 0 & ltoceiling1 > 24 & SUM(lto24sc1, lto25sc1, lto26sc1, lto27sc1, lto28sc1) = 5) ltobasal1 = 24.
IF (ltop1sc1 = 0 & ltoceiling1 > 25 & SUM(lto25sc1, lto26sc1, lto27sc1, lto28sc1, lto29sc1) = 5) ltobasal1 = 25.
IF (ltop1sc1 = 0 & ltoceiling1 > 26 & SUM(lto26sc1, lto27sc1, lto28sc1, lto29sc1, lto30sc1) = 5) ltobasal1 = 26.
IF (ltop1sc1 = 0 & ltoceiling1 > 27 & SUM(lto27sc1, lto28sc1, lto29sc1, lto30sc1, lto31sc1) = 5) ltobasal1 = 27.
IF (ltop1sc1 = 0 & ltoceiling1 > 28 & SUM(lto28sc1, lto29sc1, lto30sc1, lto31sc1, lto32sc1) = 5) ltobasal1 = 28.
IF (ltop1sc1 = 0 & ltoceiling1 > 29 & SUM(lto29sc1, lto30sc1, lto31sc1, lto32sc1, lto33sc1) = 5) ltobasal1 = 29.
IF (ltop1sc1 = 0 & ltoceiling1 > 30 & SUM(lto30sc1, lto31sc1, lto32sc1, lto33sc1, lto34sc1) = 5) ltobasal1 = 30.
IF (ltop1sc1 = 0 & ltoceiling1 > 31 & SUM(lto31sc1, lto32sc1, lto33sc1, lto34sc1, lto35sc1) = 5) ltobasal1 = 31.
EXECUTE.
ltotot1/2

Total score for the TOAL web test.
This score, with range 0 to 35, is defined as the sum of the item scores after applying the following rules: (1) items below the basal point are credited as though answered correctly; (2) items above the ceiling point are dis-credited as though answered incorrectly.
This total score was initially computed on the web server and downloaded as an item variable. However, it is re-computed here as a derived variable, as the raw score was found to be incorrect in some cases. This is because test items were prone to crash, resulting in missing item data, and corruption of the rules dictating the positions of basal and ceiling.
The test score is derived from item scores and also from the basal and ceiling positions (derived variables ltobasal1/2, ltoceiling1/2, described elsewhere on this page).

* Credit items below the basal.
* In the raw data, items 1-9 should already be credited.
* if skipped due to upward branch; but raw items are not.
* credited in other cases.
* Credit by ensuring score is 1 for any item below the basal.
IF (ltobasal1 >= 2) lto01sc1 = 1.
IF (ltobasal1 >= 3) lto02sc1 = 1.
IF (ltobasal1 >= 4) lto03sc1 = 1.
IF (ltobasal1 >= 5) lto04sc1 = 1.
IF (ltobasal1 >= 6) lto05sc1 = 1.
IF (ltobasal1 >= 7) lto06sc1 = 1.
IF (ltobasal1 >= 8) lto07sc1 = 1.
IF (ltobasal1 >= 9) lto08sc1 = 1.
IF (ltobasal1 >= 10) lto09sc1 = 1.
IF (ltobasal1 >= 11) lto10sc1 = 1.
IF (ltobasal1 >= 12) lto11sc1 = 1.
IF (ltobasal1 >= 13) lto12sc1 = 1.
IF (ltobasal1 >= 14) lto13sc1 = 1.
IF (ltobasal1 >= 15) lto14sc1 = 1.
IF (ltobasal1 >= 16) lto15sc1 = 1.
IF (ltobasal1 >= 17) lto16sc1 = 1.
IF (ltobasal1 >= 18) lto17sc1 = 1.
IF (ltobasal1 >= 19) lto18sc1 = 1.
IF (ltobasal1 >= 20) lto19sc1 = 1.
IF (ltobasal1 >= 21) lto20sc1 = 1.
IF (ltobasal1 >= 22) lto21sc1 = 1.
IF (ltobasal1 >= 23) lto22sc1 = 1.
IF (ltobasal1 >= 24) lto23sc1 = 1.
IF (ltobasal1 >= 25) lto24sc1 = 1.
IF (ltobasal1 >= 26) lto25sc1 = 1.
IF (ltobasal1 >= 27) lto26sc1 = 1.
IF (ltobasal1 >= 28) lto27sc1 = 1.
IF (ltobasal1 >= 29) lto28sc1 = 1.
IF (ltobasal1 >= 30) lto29sc1 = 1.
IF (ltobasal1 >= 31) lto30sc1 = 1.
EXECUTE.

* Uncredit items below the ceiling.
* Now un-credit all items above the ceiling (set scores to 0).
* In most cases, scores will be missing because discontinued.
* but if "2nd ceiling" established at item 5 then higher items.
* will have non-missing scores of 0 or 1.
IF (ltoceiling1 <= 5) lto06sc1 = 0.
IF (ltoceiling1 <= 6) lto07sc1 = 0.
IF (ltoceiling1 <= 7) lto08sc1 = 0.
IF (ltoceiling1 <= 8) lto09sc1 = 0.
IF (ltoceiling1 <= 9) lto10sc1 = 0.
IF (ltoceiling1 <= 10) lto11sc1 = 0.
IF (ltoceiling1 <= 11) lto12sc1 = 0.
IF (ltoceiling1 <= 12) lto13sc1 = 0.
IF (ltoceiling1 <= 13) lto14sc1 = 0.
IF (ltoceiling1 <= 14) lto15sc1 = 0.
IF (ltoceiling1 <= 15) lto16sc1 = 0.
IF (ltoceiling1 <= 16) lto17sc1 = 0.
IF (ltoceiling1 <= 17) lto18sc1 = 0.
IF (ltoceiling1 <= 18) lto19sc1 = 0.
IF (ltoceiling1 <= 19) lto20sc1 = 0.
IF (ltoceiling1 <= 20) lto21sc1 = 0.
IF (ltoceiling1 <= 21) lto22sc1 = 0.
IF (ltoceiling1 <= 22) lto23sc1 = 0.
IF (ltoceiling1 <= 23) lto24sc1 = 0.
IF (ltoceiling1 <= 24) lto25sc1 = 0.
IF (ltoceiling1 <= 25) lto26sc1 = 0.
IF (ltoceiling1 <= 26) lto27sc1 = 0.
IF (ltoceiling1 <= 27) lto28sc1 = 0.
IF (ltoceiling1 <= 28) lto29sc1 = 0.
IF (ltoceiling1 <= 29) lto30sc1 = 0.
IF (ltoceiling1 <= 30) lto31sc1 = 0.
IF (ltoceiling1 <= 31) lto32sc1 = 0.
IF (ltoceiling1 <= 32) lto33sc1 = 0.
IF (ltoceiling1 <= 33) lto34sc1 = 0.
IF (ltoceiling1 <= 34) lto35sc1 = 0.
EXECUTE.

* Re-compute test score.
* Using corrected item scores derived above.
COMPUTE ltotot1 = SUM(lto01sc1, lto02sc1, lto03sc1, lto04sc1,
 lto05sc1, lto06sc1, lto07sc1, lto08sc1, lto09sc1, lto10sc1, lto11sc1,
 lto12sc1, lto13sc1, lto14sc1, lto15sc1, lto16sc1, lto17sc1, lto18sc1,
 lto19sc1, lto20sc1, lto21sc1, lto22sc1, lto23sc1, lto24sc1, lto25sc1,
 lto26sc1, lto27sc1, lto28sc1, lto29sc1, lto30sc1, lto31sc1, lto32sc1,
 lto33sc1, lto34sc1, lto35sc1).
EXECUTE.
ltotota1/2

Adjusted version of the total score for the TOAL web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
Note that in this test, for some twins, 'discontinued' items may include items that were actually attempted but subsequently dis-credited because a 'ceiling' was established at a lower point in the test.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued (and dis-credited) items.

* All items from 4 through to 35 can be 'discontinued'.
* or discredited because they occur above the test ceiling for the twin.
* Copy existing item scores into temporary variables.
RECODE lto04sc1 lto05sc1 lto06sc1 lto07sc1 lto08sc1 lto09sc1 lto10sc1
 lto11sc1 lto12sc1 lto13sc1 lto14sc1 lto15sc1 lto16sc1 lto17sc1 lto18sc1
 lto19sc1 lto20sc1 lto21sc1 lto22sc1 lto23sc1 lto24sc1 lto25sc1 lto26sc1
 lto27sc1 lto28sc1 lto29sc1 lto30sc1 lto31sc1 lto32sc1 lto33sc1 lto34sc1 lto35sc1
 (0=0) (1=1) (SYSMIS=SYSMIS)
INTO lto04sc1a lto05sc1a lto06sc1a lto07sc1a lto08sc1a lto09sc1a lto10sc1a
 lto11sc1a lto12sc1a lto13sc1a lto14sc1a lto15sc1a lto16sc1a lto17sc1a lto18sc1a
 lto19sc1a lto20sc1a lto21sc1a lto22sc1a lto23sc1a lto24sc1a lto25sc1a lto26sc1a
 lto27sc1a lto28sc1a lto29sc1a lto30sc1a lto31sc1a lto32sc1a lto33sc1a lto34sc1a lto35sc1a.
EXECUTE.
* Where discontinued/discredited, replace score of 0 with score of 1/3.
* (in each item, select 2 out of 3 possible responses; 1 in 3 chance of correct guess).
IF (lto04an1 = -2) lto04sc1a = (1 / 3).
IF (lto05an1 = -2) lto05sc1a = (1 / 3).
IF (lto06an1 = -2) lto06sc1a = (1 / 3).
IF (lto07an1 = -2) lto07sc1a = (1 / 3).
IF (lto08an1 = -2) lto08sc1a = (1 / 3).
IF (lto12an1 = -2) lto12sc1a = (1 / 3).
IF (lto13an1 = -2) lto13sc1a = (1 / 3).
IF (lto14an1 = -2) lto14sc1a = (1 / 3).
IF (lto15an1 = -2) lto15sc1a = (1 / 3).
IF (lto16an1 = -2) lto16sc1a = (1 / 3).
IF (lto17an1 = -2) lto17sc1a = (1 / 3).
IF (lto18an1 = -2) lto18sc1a = (1 / 3).
IF (lto19an1 = -2) lto19sc1a = (1 / 3).
IF (lto20an1 = -2) lto20sc1a = (1 / 3).
IF (lto21an1 = -2) lto21sc1a = (1 / 3).
IF (lto22an1 = -2) lto22sc1a = (1 / 3).
IF (lto23an1 = -2) lto23sc1a = (1 / 3).
IF (lto24an1 = -2) lto24sc1a = (1 / 3).
IF (lto25an1 = -2) lto25sc1a = (1 / 3).
IF (lto26an1 = -2) lto26sc1a = (1 / 3).
IF (lto27an1 = -2) lto27sc1a = (1 / 3).
IF (lto28an1 = -2) lto28sc1a = (1 / 3).
IF (lto29an1 = -2) lto29sc1a = (1 / 3).
IF (lto30an1 = -2) lto30sc1a = (1 / 3).
IF (lto31an1 = -2) lto31sc1a = (1 / 3).
IF (lto32an1 = -2) lto32sc1a = (1 / 3).
IF (lto33an1 = -2) lto33sc1a = (1 / 3).
IF (lto34an1 = -2) lto34sc1a = (1 / 3).
IF (lto35an1 = -2) lto35sc1a = (1 / 3).
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE ltotota1 = SUM(lto01sc1, lto02sc1, lto03sc1,
 lto04sc1a, lto05sc1a, lto06sc1a, lto07sc1a, lto08sc1a,
 lto09sc1, lto10sc1, lto11sc1, lto12sc1a, lto13sc1a, lto14sc1a,
 lto15sc1a, lto16sc1a, lto17sc1a, lto18sc1a, lto19sc1a, lto20sc1a,
 lto21sc1a, lto22sc1a, lto23sc1a, lto24sc1a, lto25sc1a, lto26sc1a,
 lto27sc1a, lto28sc1a, lto29sc1a, lto30sc1a, lto31sc1a, lto32sc1a,
 lto33sc1a, lto34sc1a, lto35sc1a).
EXECUTE.
ltottm1/2

Total time taken (in minutes) to complete all 15 web tests.
Computed as ltottm1 in the syntax below, and later copied to variable ltottm2 on double entry.

* Compute total web test time (in minutes) but only.
* for twins who have finished all tests.
COMPUTE ltottm1 = (1/60) * SUM.15(leytime1,lhstime1,ljgtime1,
 lqntime1,lpitime1,lgotime1,
 lyntime1,lmatime1,lgktime1,lvctime1,lpctime1,lrvtime1,
 lfltime1,lintime1,ltotime1).
EXECUTE.
ltowt1/2

TOWRE overall composite score, from the raw telephone test scores (word and non-word subtests). The composite is an equally-weighted mean of the two cleaned and standardised subtest scores.

* Check validity of TOWRE raw scores as at age 7.
* Start with TOWRE data flag as default validity flag.
COMPUTE ltwvalid1 = ltwdata1.
COMPUTE ltwvalid2 = ltwdata2.
EXECUTE.
* Invalid (cannot be used) if either main score is missing.
IF (SYSMIS(ltwwdt1) | SYSMIS(ltwnwt1)) ltwvalid1 = 0.
IF (SYSMIS(ltwwdt2) | SYSMIS(ltwnwt2)) ltwvalid2 = 0.
EXECUTE.
* affects 10 twins.
* Also invalid if a practice score is >=5 and corresponding main score is 0.
IF (ltwwdpt1 >= 5 & ltwwdt1 = 0) ltwvalid1 = 0.
IF (ltwwdpt2 >= 5 & ltwwdt2 = 0) ltwvalid2 = 0.
IF (ltwnwpt1 >= 5 & ltwnwt1 = 0) ltwvalid1 = 0.
IF (ltwnwpt2 >= 5 & ltwnwt2 = 0) ltwvalid2 = 0.
EXECUTE.
* affects 2 twin in the non-word test.
* Where invalid, recode scores to missing and set data flag to 0.
DO IF (ltwdata1 = 1 & ltwvalid1 = 0).
 RECODE ltwwdpt1 ltwwdt1 ltwnwpt1 ltwnwt1 (ELSE=SYSMIS).
 RECODE ltwdata1 (1=0).
END IF.
DO IF (ltwdata2 = 1 & ltwvalid2 = 0).
 RECODE ltwwdpt2 ltwwdt2 ltwnwpt2 ltwnwt2 (ELSE=SYSMIS).
 RECODE ltwdata2 (1=0).
END IF.
EXECUTE.
* Practice scores and validity flags no longer needed: drop at end of this script.

* Filter out all the standard twin exclusions.
* (medical, perinatal, unknown sex/zyg, missing 1st Contact).
* before standardisation.
USE ALL.
COMPUTE filter_$=(exclude1 = 0).
VARIABLE LABELS filter_$ 'exclude1 = 0 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

* Now standardise the TOWRE word and non-word scores.
DESCRIPTIVES
  VARIABLES= ltwwdt1 ltwwdt2 ltwnwt1 ltwnwt2 /SAVE .

* TOWRE composite.
* Equally weighted mean of the two standardised scores.
COMPUTE towt1 = MEAN.2(Zltwwdt1, Zltwnwt1).
COMPUTE towt2 = MEAN.2(Zltwwdt2, Zltwnwt2).
EXECUTE.
* Now standardise the resulting composite.
DESCRIPTIVES
  VARIABLES= towt1 (ltowt1) towt2 (ltowt2) /SAVE .

* Standardisations finished - remove filter.
FILTER OFF.
USE ALL.
EXECUTE.
ltqage1/2

Age of twin (in decimal years) when the teacher questionnaire was returned.
Derived from the return date of the teacher questionnaire (ltrdate1/2) and the birth date of the twins (aonsdob). These date variables are not retained in the dataset.

* Age when teacher questionnaire returned.
COMPUTE ltqage1 = RND((DATEDIFF(ltrdate1, aonsdob, "days")) / 365.25, 0.1).
EXECUTE.
ltqLLCage1/2, ltqLLCdate1/2

See lcqLLCage1/2, etc above.

ltsci1/2

See lp2ac1/2, etc above.

ltsdqbeht1/2

See lcsdqbeht1/2, etc above.

ltsdqcont1/2

See lcsdqcont1/2, etc above.

ltsdqemot1/2

See lcsdqemot1/2, etc above.

ltsdqhypt1/2

See lcsdqhypt1/2, etc above.

ltsdqpert1/2

See lcsdqpert1/2, etc above.

ltsdqprot1/2

See lcsdqprot1/2, etc above.

ltwelvyr

Data flag, to show presence of any data (from parent, twin or teacher) in the 12 Year study.
Coded as 1=yes (data present).
The syntax below is executed on the full dataset, after merging together all data sources.

* The dataset at this stage contains all the 12 year data.
* Only retain twin pairs having some data at 12.
* (parent qnr data, teacher data for either twin, or.
* web or qnr or Towre data for either twin).
FILTER OFF.
USE ALL.
SELECT IF(lpdata = 1 | ltqdata1 = 1 | ltqdata2 = 1 | lcwdata1 = 1
 | lcwdata2 = 1 | lcqdata1 = 1 | lcqdata2 = 1 | ltwdata1 = 1 | ltwdata2 = 1).
EXECUTE .

* Add data flag to show presence of any data at this age.
COMPUTE ltwelvyr = 1.
EXECUTE.
lvcatm1/2

Mean item answer time (in seconds) for the twin Vocabulary web test.
Computed as lvcatm1 in the syntax below, and later copied to variable lvcatm2 on double entry.

COMPUTE lvcatm1 = MEAN(lvc01at1,lvc02at1,lvc03at1,
 lvc04at1,lvc05at1,lvc06at1,lvc07at1,lvc08at1,
 lvc09at1,lvc10at1,lvc11at1,lvc12at1,lvc13at1,lvc14at1,lvc15at1,lvc16at1,
 lvc17at1,lvc18at1,lvc19at1,lvc20at1,lvc21at1,lvc22at1,lvc23at1,lvc24at1,
 lvc25at1,lvc26at1,lvc27at1,lvc28at1,lvc29at1,lvc30at1).
lvctota1/2

Adjusted version of the total score for the Vocabulary web test.
The score is adjusted for twins who discontinued the test; for each discontinued item, the default score of zero is replaced by the 'chance' score, namely the mean score that would be obtained by selecting an answer at random.
The syntax below is executed after recoding item response variables from missing to -2 for all discontinued items.

* In theory, can discontinue from item 7 onwards.
* Copy existing item scores into temporary variables.
* Note there are 2-point and 1-point scores.
RECODE lvc07sc1 lvc08sc1 lvc09sc1 lvc10sc1 lvc11sc1 lvc12sc1
 lvc13sc1 lvc14sc1 lvc15sc1 lvc16sc1 lvc17sc1 lvc18sc1 lvc19sc1
 lvc20sc1 lvc21sc1 lvc22sc1 lvc23sc1 lvc24sc1 lvc25sc1 lvc26sc1
 lvc27sc1 lvc28sc1 lvc29sc1 lvc30sc1 (0=0) (1=1) (2=2) (SYSMIS=SYSMIS)
INTO lvc07sc1a lvc08sc1a lvc09sc1a lvc10sc1a lvc11sc1a lvc12sc1a
 lvc13sc1a lvc14sc1a lvc15sc1a lvc16sc1a lvc17sc1a lvc18sc1a lvc19sc1a
 lvc20sc1a lvc21sc1a lvc22sc1a lvc23sc1a lvc24sc1a lvc25sc1a lvc26sc1a
 lvc27sc1a lvc28sc1a lvc29sc1a lvc30sc1a.
EXECUTE.
* Where discontinued, replace score of 0 with chance score.
* All items 7-30 have 4 possible responses.
* Items 7-8 have just one correct response, scoring 2: chance score is 2/4.
* Items 9-30 have two correct responses, scoring 1 and 2: chance score is 3/4.
IF (lvc07an1 = -2) lvc07sc1a = 0.5.
IF (lvc08an1 = -2) lvc08sc1a = 0.5.
IF (lvc09an1 = -2) lvc09sc1a = 0.75.
IF (lvc10an1 = -2) lvc10sc1a = 0.75.
IF (lvc11an1 = -2) lvc11sc1a = 0.75.
IF (lvc12an1 = -2) lvc12sc1a = 0.75.
IF (lvc13an1 = -2) lvc13sc1a = 0.75.
IF (lvc14an1 = -2) lvc14sc1a = 0.75.
IF (lvc15an1 = -2) lvc15sc1a = 0.75.
IF (lvc16an1 = -2) lvc16sc1a = 0.75.
IF (lvc17an1 = -2) lvc17sc1a = 0.75.
IF (lvc18an1 = -2) lvc18sc1a = 0.75.
IF (lvc19an1 = -2) lvc19sc1a = 0.75.
IF (lvc20an1 = -2) lvc20sc1a = 0.75.
IF (lvc21an1 = -2) lvc21sc1a = 0.75.
IF (lvc22an1 = -2) lvc22sc1a = 0.75.
IF (lvc23an1 = -2) lvc23sc1a = 0.75.
IF (lvc24an1 = -2) lvc24sc1a = 0.75.
IF (lvc25an1 = -2) lvc25sc1a = 0.75.
IF (lvc26an1 = -2) lvc26sc1a = 0.75.
IF (lvc27an1 = -2) lvc27sc1a = 0.75.
IF (lvc28an1 = -2) lvc28sc1a = 0.75.
IF (lvc29an1 = -2) lvc29sc1a = 0.75.
IF (lvc30an1 = -2) lvc30sc1a = 0.75.
EXECUTE.
* Compute adjusted total score as the sum of the item scores.
* using adjusted item scores where available.
COMPUTE lvctota1 = SUM(lvc01sc1, lvc02sc1, lvc03sc1, lvc04sc1,
 lvc05sc1, lvc06sc1, lvc07sc1a, lvc08sc1a, lvc09sc1a, lvc10sc1a,
 lvc11sc1a, lvc12sc1a, lvc13sc1a, lvc14sc1a, lvc15sc1a, lvc16sc1a,
 lvc17sc1a, lvc18sc1a, lvc19sc1a, lvc20sc1a, lvc21sc1a, lvc22sc1a,
 lvc23sc1a, lvc24sc1a, lvc25sc1a, lvc26sc1a, lvc27sc1a, lvc28sc1a,
 lvc29sc1a, lvc30sc1a).
EXECUTE.
lynatm1/2

Mean item answer time (in seconds) for the twin Yes/No web test.
Computed as lynatm1 in the syntax below, and later copied to variable lynatm2 on double entry.

COMPUTE lynatm1 = MEAN(lyn01at1,lyn02at1,lyn03at1,
 lyn04at1,lyn05at1,lyn06at1,lyn07at1,lyn08at1,
 lyn09at1,lyn10at1,lyn11at1,lyn12at1,lyn13at1,lyn14at1,lyn15at1,lyn16at1,
 lyn17at1,lyn18at1,lyn19at1,lyn20at1,lyn21at1,lyn22at1,lyn23at1,lyn24at1,
 lyn25at1,lyn26at1,lyn27at1,lyn28at1,lyn29at1,lyn30at1,lyn31at1,lyn32at1,
 lyn33at1,lyn34at1,lyn35at1,lyn36at1,lyn37at1,lyn38at1,lyn39at1,lyn40at1,
 lyn41at1,lyn42at1,lyn43at1,lyn44at1,lyn45at1,lyn46at1,lyn47at1,lyn48at1,
 lyn49at1,lyn50at1,lyn51at1,lyn52at1,lyn53at1,lyn54at1,lyn55at1,lyn56at1,
 lyn57at1,lyn58at1,lyn59at1,lyn60at1,lyn61at1,lyn62at1,lyn63at1,lyn64at1,
 lyn65at1,lyn66at1,lyn67at1,lyn68at1,lyn69at1,lyn70at1,lyn71at1,lyn72at1,
 lyn73at1,lyn74at1,lyn75at1,lyn76at1,lyn77at1,lyn78at1,lyn79at1,lyn80at1,
 lyn81at1,lyn82at1,lyn83at1,lyn84at1,lyn85at1,lyn86at1,lyn87at1,lyn88at1,
 lyn89at1,lyn90at1,lyn91at1,lyn92at1,lyn93at1,lyn94at1,lyn95at1,lyn96at1,
 lyn97at1,lyn98at1).