S&P 500 rises for seventh week