Introduction Infants delivered preterm are at increased risk of neurodevelopmental problems including impaired intelligence and school performance ,. Amongst preterm infants there is no evidence of a threshold effect, with the risk declining steadily with advancing gestational age up to 36 wk. However, there is a lack of information on whether the increased risk continues across the early term period (37–39 wk of gestation). This question is of considerable clinical relevance because early term births account for an increasing proportion of deliveries , and many of these are elective deliveries. The aim of our study was to investigate the risk of special educational need (SEN) across the whole spectrum of gestational age at delivery, and to use these results to determine the population attributable risks associated with delivery at different gestational ages. Methods Data Sources Under the Special Educational Needs and Disability Act of 2001, both schools and local education authorities in the United Kingdom have a statutory duty to identify, assess, and make provision for children with SEN. The Department of Education defines SEN as a learning difficulty that requires special educational provision. In turn, a learning difficulty is defined as either greater difficulty in learning than a majority of children of the same age, or a disability that prevents or hinders a child from making use of educational facilities of the kind that are generally provided for children of the same age (http://www.teachernet.gov.uk/_doc/3724/SENCodeOfPractice.pdf). SEN includes both children with learning disabilities (including dyslexia, dyspraxia, autism, Asperger's syndrome, and attention deficit hyperactivity disorder), as well as children with physical disabilities that impact on learning (including some children with hearing, motor, and visual impairments). We used data from the 2005 school census. The school census is undertaken annually in September and the data are provided by head-teachers at each school and collated by their local education authority. The school census covers all schools in Scotland irrespective of their funding source and includes local authority, grant-aided, independent, and self-governing schools. The response rate is 99.8%. It includes all primary and secondary school children. It excludes adults (>19 y of age) who are attending courses held in schools. It covers mainstream schools, special schools, and special classes and units within mainstream schools. Children on long-term illness absence are included. The information is collected at the level of individual pupils and includes a record of need for all children with an SEN. Of the 32 Scottish local education authorities, 19 agreed to participate and provide data from the school census. The participating authorities covered a total population of 3.8 million, equivalent to 74% of the Scottish population (http://www.statistics.gov.uk/STATBASE/Expodata/Spreadsheets/D5966.xls). The Scottish Morbidity Record (SMR2) collects information on all women discharged from Scottish maternity hospitals, including maternal and infant characteristics, clinical management, and obstetric complications. The SMR2 is subjected to regular quality assurance checks and has been more than 99% complete since the late 1970s . A quality assurance exercise performed in 1997 compared a 5% sample of SMR2 returns (n = 1,414) to case records and demonstrated that all of the fields used in our study had less than 2% errors, with the exception of maternal height (4.4%), estimated gestation (5.6%), and induction of labour (6.4%) (Jim Chalmers, Information Services Division, National Health Service, Edinburgh, Scotland, written communication, April 2001). In the SMR2, gestational age at birth is defined as completed weeks of gestation on the basis of the estimated date of delivery recorded in each woman's clinical record. Gestational age has been confirmed by ultrasound in the first half of pregnancy in more than 95% of women in the United Kingdom since the early 1990s . Previous miscarriage was defined as previous delivery of a conceptus, showing no signs of life before 24 wk gestation, excluding therapeutic abortions. Previous therapeutic abortion was defined as previous therapeutic termination of pregnancy, by any means, prior to 24 wk gestation. The school census data were linked, via birth certificate data, to the relevant SMR2 record to provide individual-level obstetric data. We excluded individuals who were aged 19 y at the time of the school census, and births where the maternal height was recorded as less than 100 cm or greater than 200 cm, the birth weight was recorded as less than 400 g or greater than 5,000 g, or the gestation at delivery was recorded as less than 24 wk or greater than 43 wk. We also excluded multiple births because the SMR2 record does not record infant name. Therefore, in the case of multiple births, we could not ensure that the school census record was linked to the correct infant. Permission to access, link, and analyse these data was granted by both the South-East of Scotland Multi-Centre Research Ethics Committee and the Scottish Privacy Advisory Committee. Statistical Analysis Continuous variables were summarised by the median and interquartile range (IQR). Univariate comparisons between groups were performed using the Kruskal-Wallis test, Chi square test, and Cuzick's test for trend  for continuous, categorical, and ordinal data, respectively. The p-values for all hypothesis tests were two-sided and statistical significance was assumed at p 39 1.31 (1.17–1.48) 174 0.92 (0.83–1.01) 0.071 1.09 (0.97–1.19) 0.154 p for trend 40 wk compared those delivered at 38–40 wk . Our study has a number of strengths. It is the largest study of its kind and the first unselected, population-based study to examine risk over the whole gestational spectrum. Being based on a national population register, it is not subject to selection bias. The obstetric and SEN data were obtained from routine data sources obviating possible recall, response, or ascertainment bias. Our ascertainment of SEN included all school-age children irrespective of type of school and was, therefore, representative of the population as a whole. Because Scotland has a stable population and high quality routine data sources, a very high percentage of pupils could be linked to their birth records. The obstetric register is detailed and accurate enabling adjustment for a wide range of possible confounding factors. A number of previous studies have examined birth weight, rather than gestation. Although mean birth weight is lower among preterm infants, individual low birth weight is a poor proxy of gestation since it is also a marker of intra-uterine growth restriction. Furthermore, there is an interaction between absolute birth weight and gestational age, such that low birth weight is a risk factor for intellectual impairment among term infants but not preterm infants ,,. Therefore, a specific strength of our study is that we measured gestation and adjusted for sex- and gestation-specific birth-weight centile, rather than using absolute birth weight. Wiener et al. restricted their analysis to infants of normal birth weight and demonstrated lower IQ scores at 8–10 y of age among those born preterm compared with those born at term . Early term deliveries have increased over time. The normal timing of elective delivery has changed over time from 37 towards 39 wk. 75% of deliveries at 39 wk are elective (unpublished SMR2 data). However, our data suggest that even at 39 wk infants are at increased risk of SEN and account for 1.7% of all SEN cases. These findings have implications for clinical practice in relation to both the decision to undertake elective delivery and the timing of elective deliveries. Supporting Information Text S1 Sensitivity analysis. (0.04 MB DOC) Click here for additional data file.