A process for producing a complex of a lanthanide or similar compound with a macrocyclic ligand, wherein the ratio of macrocyclic ligand in free form in relation to the lanthanide or similar compound is equal or more than 0.002% mol/mol, includes the steps of a) measuring the moisture content in a sample of the macrocyclic ligand; and b) mixing an amount G of the lanthanide with an amount X3 of the macrocyclic ligand with the proviso that X3=LG+Lf+M, wherein LG is the amount of macrocyclic ligand necessary for complexing the amount G of lanthanide or similar compound, Lf is an excess amount of the macrocyclic ligand, and M is the amount of moisture present in the amount X3 of the macrocyclic ligand.