The reaction of methyl valerolactim (1) with cyclic β-aminoester (6) afforded only 1, 9-diazasteroid (14), whereas that of methyl valerothiolactim (2) with 6 led to the cyclic diamide (12) together with 14. The latter reaction, followed by iodination and reduction, gave 5, 9-diazasteroid (17).