NEW YORK -- A weak showing in home sales and a mixed batch of earnings reports kept stocks flipping between minor gains and losses on Wall Street. By the end of the day, the major indexes managed to eke out their second day of gains this week.
A strong profit report from Procter & Gamble helped indexes start higher early Thursday, but stocks weakened in late morning trading after a realtor group said that the pace of contracts for new home sales had leveled off.
The Dow Jones industrial average gained 26.34 points to close at 13,103.68.
"This is a market still working through a difficult earnings season," said Jason Pride, the director of investment strategy for Glenmede, a wealth-management firm.
Pride said investors probably celebrated too much after the Federal Reserve pledged more support for the economy in early September. They overlooked shrinking economies in Europe, slower growth in China and other signs that this earnings season would be rough. In the past two weeks, they've paid for it.
"We had a party and now we're dealing with a hangover," he said. "The market is basically back to where it was at the end of August. I don't think that's unreasonable."
In other trading, the Standard & Poor's 500 rose 4.22 points to 1,412.97 and the Nasdaq gained 4.42 points to 2,986.12.
A recent round of weak corporate earnings from tech giants and industrial companies has shaken investors accustomed to steadily rising profits. Weak revenue numbers and lowered profit projections from Caterpillar, 3M and Google have rattled the stock market.
After two days in which the Dow has dropped more than 200 points in the past week, the average of 30 big companies is now down 2.5 percent for October.
Among companies reporting earnings Thursday, infant formula maker Mead Johnson Nutrition plunged 9 percent after its revenue came in well below what Wall Street analysts had expected. The company also cut its forecast for full-year earnings. Its stock slumped $5.98 to $63.53.
Profits at United Airlines slid with fewer people flying, and the company's results fell short of Wall Street's forecasts. Its stock lost $1.01 to $19.26.
Most homebuilders fell after the pace of growth in housing sales slowed last month. PulteGroup fell 44 cents to $17.01. Toll Brothers dropped $1.04 to $34.21.
Procter & Gamble posted the strongest gains of any Dow stock, after the consumer products company, whose products include Tide, Gillette and Charmin, posted earnings that beat analysts' estimates. P&G rose $1.99 to $70.07.
Online game maker Zynga jumped 26 cents to $2.39 after the company reported revenue that was stronger than analysts had anticipated. The company also said it would cut costs and enter the gambling business.
Health insurer Aetna rose 48 cents to $44.43 after reporting a slight gain in third-quarter earnings. Higher revenue and lower-than-expected health care claims helped the company beat Wall Street's profit expectations.
Traders sold U.S. government bonds, sending yields higher. The benchmark 10-year U.S. Treasury note yielded 1.82 percent, up from 1.79 percent late Wednesday.