Can you get cancer if you not had a period for more than a year?

Depends. What type of cancer are you talking about? Uterine and cervical cancers have nothing to do with your periods per se.
Possibly. If you are not menopausal and not on hormonal contraceptives or hrt, lack of periods can be associated with certain ovarian tumors. Please consult a ob/gyn at the earliest.