Man beats cancer, walks marathon in hospital