U.S. stock indexes closed nearly flat on Wednesday after drifting between small gains and losses most of the day.

Supermarket chains and other consumer-focused companies were among the biggest decliners, while energy stocks led gainers. The Nasdaq composite eked out a gain, giving the index its second record-high close in two days.

Investors weighed a mix of new economic data and their implications for a potential Federal Reserve rate hike.

On Wednesday:

The Dow Jones industrial average slipped 11.98 points, or 0.1 percent, to 18,526.14.

The Standard & Poor’s 500 index dipped 0.32 points, or 0.01 percent, to 2,186.16.

The Nasdaq composite rose 8.02 points, or 0.2 percent, to close at a record 5,283.93.

For the week:

The Dow is up 34.18 points, or 0.2 percent.

The S&P 500 is up 6.18 points, or 0.3 percent.

The Nasdaq is up 34.03 points, or 0.7 percent.

For the year:

The Dow is up 1,101.11 points, or 6.3 percent.

The S&P 500 is up 142.22 points, or 7 percent.

The Nasdaq is up 276.52 points, or 5.5 percent.

VIAThe Associated Press
The AP is one of the largest and most trusted sources of independent newsgathering. AP is neither privately owned nor government-funded; instead, as a not-for-profit news cooperative owned by its American newspaper and broadcast members, it can maintain its single-minded focus on newsgathering and its commitment to the highest standards of objective, accurate journalism.