Trigonal rare-earth dioxymonocyanamides Ln2O2CN2 (Ln=Dy, Ho, Er, Tm, Yb) were synthesized by the modified solid-state metathesis (SSM) method, in which Ln2O3 and melamine C3N6H6 were mixed and heated at 850 °C in vacuumed silica ampoules. Possible chemical reaction pathways are proposed. X-ray diffraction (XRD) patterns of Ln2O2CN2 were refined using the Rietveld method. Compounds Ln2O2CN2 crystallize in the trigonal system with space group P3m1, Z=1, and cell parameters of a and c varying from 3.7267(1) to 3.6407(1) Å and from 8.1848(3) to 8.1152(3) Å, respectively, as Ln atoms change from Dy to Yb. These compounds have stacking structures of Ln2O22+ and CN22− layers, similar to those of previously reported compounds Ln2O2CN2 (Ln=Ce, Pr, Nd, Sm, Eu, Gd). The presence of CN22− ions has been confirmed by infrared spectroscopy, with two characteristic peaks in the vicinity of 651 and 2075 cm−1.