Thin films of yttrium oxide and zirconium oxide have been deposited by ion beam sputtering (IBS) of a Y2O3 and a ZrO2-10% Y2O3 target. It is shown that it is possible to alter the refractive index by changing the ratio between oxygen and argon flows introduced in the ion gun. Thus a high refractive index quite close to the bulk one could be obtained. However, these initial coatings displayed a high absorption close to the UV absorption edge of the bulk material. Usually, this defect is attributed to a lack or an excess of oxygen; however absorption due to impurities can be considered too. In order to clear up this point, chemical analyses such as Rutherford backscattering spectrometry (RBS), secondary ion mass spectrometry (SIMS) and X-ray fluorescence spectroscopy (XRF) were carried out. It was found that metallic impurities sputtered from the wall of the chamber and the target holder were in fact involved in the absorption process. By reducing the divergence of the ion beam due to charge effects on the target, non-absorbing compact films were obtained in correlation with a lower amount of metallic impurities.