By Kate Gibson

The stock market's enthusiasm over the government's "cash for clunkers" program waned Thursday in the face of data suggesting consumers exchanged old cars for newer models at the expense of other retail spending.

Investors were taken back by the Commerce Department's report that U.S. retail sales fell 0.1% in July, as opposed to expectations sales would gain 0.8%. Excluding autos, retail sales declined 0.6% versus an expected gain of 0.1%. .

"The decline in retail sales is quite startling to say the least. The cash for clunkers program was expected to have had quite an effect on retail sales [but] motor vehicle and parts rose only 2.4%; expectations had looked for a gain more than double. Sales at auto and other motor vehicle dealers were up just 2.8%, a healthy gain to be certain but far less than many economists expected," Dan Greenhaus, chief economic strategist, Miller Tabak & Co., wrote in an emailed note.

The data helped offset early-day investor cheer, bolstered in part by earnings results from retail goliath Wal-Mart Stores Inc. (WMT), leaving the major stock indexes meandering between positive and negative turf.

While the worst is behind, the country's economic troubles persist, with the July retail report illustrating the recession is unlike its predecessors, said Liz Miller, president of Summit Place Financial Advisors.

"We have a lot of consumers realizing that they've really got to be reducing personal debt. That does hamper consumer spending," said Miller. Listen to more.

The Dow Jones Industrial Average (DJI) was lately up 7.71 points at 9,369.32. The S&P 500 Index (SPX) rose 2.64 points to 1,008.61, while the technology-led Nasdaq Composite (RIXF) gained 5.07 points to stand at 2,003.79.

Shares of home builders and auto retailers were among Thursday's heaviest weights on the consumer-discretionary sector, including shares of AutoZone Inc. (AZO) and AutoNation Inc. (AN), both down nearly 3%.

"All the cash-for-clunkers [program] did was steal sales from other retailers. We'd argue that even more damage was done, as consumers who did turn in their clunkers likely surrendered assets with at least some residual value for debt and an equity stake in a sharply deteriorating asset," said T.J. Marta, chief market strategist, Marta on the Markets LLC.

The government's retail report had furniture sales slipping 0.9%, electronics declining 1.4%, building materials off 2.1% and sales at department stores down 1.6%, "the fifth consecutive decline in this measure and the largest decline since December," said Greenhaus.

Leading sector losses, shares of home-building giant D.R. Horton Inc. (DHI) fell nearly 4%, with D.R. Horton shares also downgraded by Citigroup analyst Josh Levin.

Speaking ahead of Thursday's retail report, Howard Ward, chief investment officer of Gamco Growth Fund, pointed to the government's incentive program as evidence that the consumer "is not dead [but] still has a pulse."

"These are not Wall Street types trading in their Beemers," Ward added.