Exercising in the year before a cancer diagnosis can reduce the odds of the disease progressing by up to 27%, a study has suggested.