The definition of compositional effect is
The term “compositional effects” is used here to refer to a range of observations about how using group averages can paint a misleading picture about how individuals are doing.
I tried to find an example about this effect in panel data but I just found an example about migration that
Suppose country A has a mean income of 1000 per capita per annum and country B has a mean income of 10000 per capita per annum. Suppose a worker with an income of 2000 per annum in country A moves to country B, and sees his income rise to 5000 per annum. The means of both countries have gone down, because country A lost an above-average earner and country B gained a below-average earner.
I am wondering is there any example for the compositional effect in panel data? Why sometimes in panel data, why we run the regression for different years, we use the same subset of units available for all those horizons to avoid the compositional effect? I ask this question because from the help file of did_imputation, I saw that

Estimate the ATT at horizons 0..+6 for the subset of units available for all of these horizons (such that the dynamics are not driven by compositional effects)