Abstract
We express the Frobenius--Hecke traces on the compactly supported cohomology of a Shimura variety of abelian type in terms of elliptic parts of stable Arthur--Selberg trace formulas for the endoscopic groups. This confirms predictions of Langlands and Kottwitz at primes where the level is hyperspecial.