NEW YORK (AP) — U.S. stocks edged back from their record heights Thursday after the Dow Jones Industrial Average briefly topped the 40,000 level for the first time.

The Dow slipped 38.62 points, or 0.1 per cent, to 39,869.38. The S&P 500 index, which is much more widely followed on Wall Street, dipped 11.05, or 0.2 per cent, to 5,297.10, and the Nasdaq composite fell 44.07, or 0.3 per cent, to 16,698.32. All three indexes had rallied on Wednesday to all-time highs.

Deere weighed on the market and sank 4.7 per cent despite reporting stronger profit for its latest quarter than expected. It cut its forecast for upcoming profit this fiscal year, below analysts’ estimates, as farmers buy fewer tractors and other equipment.

Homebuilders also helped drag the market lower following a weaker-than-expected report on the housing industry. They gave back some of their big gains from the day before, when hopes for lower mortgage rates had sent them sharply higher. D.R. Horton sank 4.2 per cent, Lennar fell 3.3 per cent and PulteGroup dropped 2.8 per cent.

Also sinking were GameStop and AMC Entertainment, which slid for a second straight day following their jaw-dropping starts to the week. They’ve been moving more on excitement drummed up by investors than any changes to their financial prospects.

GameStop fell 30 per cent, though it’s still up nearly 59 per cent for the week so far. AMC Entertainment lost 15.3 per cent.

Such drops helped offset a seven per cent jump for Walmart, which reported stronger profit for the latest quarter than analysts expected. The retailer also said its revenue for the year could top the forecasted range it had earlier given.

Walmart's strength could be an encouraging signal for the broader economy. Worries have been rising about whether U.S. households can keep up with still-high inflation and more expensive credit-card payments, particularly households at the lower end of the income spectrum.

Target, which reports its quarterly results next week, climbed following Walmart's report, along with other retailers like Dollar General and Dollar Tree. Each added at least two per cent.

Chubb rose 4.7 per cent after Warren Buffett’s Berkshire Hathaway disclosed it had built an ownership stake in the insurer.

Under Armour swung between losses and gains after it warned that its revenue will be likely down by “a low double-digit percentage rate” this upcoming fiscal year, citing weaker demand from wholesalers and “inconsistent execution across our business.”

The company announced a restructuring plan to cut costs and also announced a program to buy back up to US$500 million of its stock. It dropped 1.3 per cent.

Stronger-than-expected profit reports have been one of the main reasons U.S. stock indexes have broadly jumped through May to records following a tough April. Another has been revived hopes that the Federal Reserve will be able to cut its main interest rate at least once this year. The Fed has been keeping its federal funds rate at the highest level in more than two decades.

A string of worse-than-expected reports on inflation at the start of the year had put the potential for such cuts in jeopardy, but some more encouraging data has since arrived.

Treasury yields have largely eased in May as hopes rose that the economy could hit the hoped-for sweet spot, where it cools enough because of high interest rates to stifle inflation but not so much that it causes a bad recession.

Yields rose Thursday following some mixed data on the economy, including the report that hurt homebuilder stocks, which showed the industry broke ground on fewer projects than expected.

One report showed slightly more workers applied for unemployment benefits last week than economists expected, though the number remains low compared with history. Others said manufacturing growth in the mid-Atlantic region was weaker than hoped and import prices rose more than forecast.

“Today’s numbers were in line with the overall theme of the week — nothing dramatic, but showing signs of a steady-to-cooling economy,” said Chris Larkin, managing director, trading and investing, at E-Trade from Morgan Stanley.

The yield on the 10-year Treasury climbed to 4.37 per cent from 4.35 per cent late Wednesday. The two-year yield, which moves more closely with expectations for action by the Fed, rose to 4.79 per cent from 4.72 per cent.

In stock markets abroad, indexes were modestly lower in much of Europe after mostly rising in Asia. Hong Kong’s Hang Seng jumped 1.6 per cent after reopening following a holiday, while Japan’s Nikkei 225 rose 1.4 per cent.