This phase I trial is studying the side effects and best dose of decitabine in treating patients with myelodysplastic syndromes or acute myeloid leukemia. Drugs used in chemotherapy use different ways to stop cancer cells from dividing so they stop growing or die.