You should actually masturbate 4-5 times a week at least, it's been empirically proven to significantly reduce the risk of prostate cancer. Having sex or not doesn't really matter in this respect, but people who have healthy sex lives tend to be happier and mentally as well as physically healthier on average than those who don't.