The anharmonic behavior of the Raman-active oxygen modes was examined in YBa2Cu316,18 O-x compounds over the whole range of oxygen doping (6 < x < 7). The apex phonon of A(g) symmetry shows a small. anharmonicity in the range of 6.4 < x < 6.9, which can be attributed to the anharmonic behavior of this mode in one of the constituent phases (ortho-II, ortho-III, etc.), but not in the ortho-I phase. The B-1g mode does not show any anharmonicity over the whole range of oxygen doping, but characteristic spectral changes appear for x approximate to 6.3 and 6.7. At the lowest oxygen content studied (x = 6.03), there is a considerable amount of anharmonicity for the in-phase phonon of the plane oxygen atoms, which remains large until x approximate to 6.3, at the phase transition to the tetragonal phase, where it drops to zero. It increases again for x approximate to 6.4 and then gradually decreases with doping to disappear at the optimal doping. If these changes are combined with the spectral modifications of the B-1g and in-phase modes, they indicate that local structural changes are induced by the transfer of carriers to the CuO2 planes at x approximate to 6.3, which are related to the reduction in anharmonicity, the pinning of the carriers and superconductivity. Copyright (C) 2001 John Wiley & Sons, Ltd.