Chinese girls are postcode winners
The figures show attainment is better if you live in rural areas, if you are female, if you are younger, if you are Chinese and if you are not registered for free meals.
The data is based on the tariff system in which a scale of points is calculated for the range of qualifications, with a top A pass in Advanced Higher earning 120 points, an A in Higher 72 points and a Standard grade 1 38.
This reveals that the average score for all pupils in S4 last year was 170 - but 178 for girls and 161 for boys. The best performers in any category were Chinese youngsters, who scored 209.
In the same year group, there were some stark contrasts: pupils in remote rural areas scored 189, against 161 in large urban areas; youngsters on free meals earned 110 points against 180 for those not registered; children with a record of needs notched up 81 points in contrast to 173 for those with no record; looked-after young people had 68 points, while others were on 171.
One of the more striking features was what difference a year can make.
Pupils in fourth year last year who were born before March 1989 had an average score of 137, compared to 214 points for those born after February 1990.
One possible explanation is that the older pupils could have had setbacks of various kinds in the course of their schooling, such as having been held back a year.