(AP) -- Wall Street capped a record-setting week with a day of mostly listless trading Friday that left the three major U.S. stock indexes essentially flat.
The Dow Jones industrial average and the Standard & Poor's 500 index closed slightly lower. The Nasdaq composite eked out a tiny gain, giving the tech-heavy index its fourth record-high close in a week.
Investors mostly focused on the latest batch of company earnings from retailers and other companies, as well as new data indicating that U.S. retail sales in July were more sluggish than expected.
Materials companies fell the most. Energy stocks led the gainers as crude oil prices rose again.
While the retail sales data may have dimmed some traders' views on the economy, most of the selling was likely a reflection of some investors locking in profits while the market remains near its all-time high, said JJ Kinahan, TD Ameritrade's chief strategist.
"It's a summer Friday on a week that we were higher," Kinahan said. "It's more of a 'Why take unnecessary risks? Take some profits, go home happy.'"
The Dow fell 37.05 points, or 0.2 percent, to 18,576.47. The S&P 500 index lost 1.74 points, or 0.1 percent, to 2,184.05. The declines pulled both indexes slightly below their most-recent all-time highs set Thursday.
The Nasdaq bucked the trend, adding 4.50 points, or 0.1 percent, to 5,232.89. The Nasdaq also closed at a record high last Friday, Tuesday and Thursday. It's now up 11 percent over the past seven weeks, the longest winning streak for the index in more than four years.
So far this year, the Dow is up 6.6 percent, the S&P 500 has gained 6.9 percent and the Nasdaq is up 4.5 percent.
Strong job growth, more stable oil prices and a crop of better-than-expected company earnings have helped lift stocks in recent weeks.
This week, investors had their eye on the health of retailers. They welcomed the latest quarterly snapshots for Macy's, Kohl's and Nordstrom, sending their shares higher.
Some of that continued Friday as traders cheered results from Nordstrom, J.C. Penney and Dillard's.
Nordtsrom surged 8 percent a day after the department store chain reported earnings that beat Wall Street's expectations. The company also raised its profit guidance for the year. The stock gained $3.82 to $51.38.
J.C. Penney said a pickup in sales helped trim the chain's second-quarter loss from a year earlier. The stock added 61 cents, or 6.1 percent, to $10.55. Dillard's rose 3.4 percent after the retailer posted a second-quarter profit that was larger than analysts expected. Its shares gained $2.26 to $68.67.
Even so, the government's latest retail sales figures appeared to dampen on some of that optimism.
The Commerce Department said that U.S. retail sales held steady in July from the previous month, as Americans spent less at grocery stores, clothing shops, sporting goods and electronics and appliance outlets. Those declines were offset by big increases in auto sales and on online and catalog sales.
Separately, the Labor Department said producer prices posted the biggest drop last month since September, pulled down by tumbling energy, clothing and food prices. Inflation remains modest at both producer and consumer levels.
Despite the downbeat economic data, the market spent much of the day hovering just below its all-time highs.
"It's very understandable that people are not particularly keen to rush into buying at these historically high levels," said Erik Davidson, chief investment officer at Wells Fargo Private Bank. "Add in this economic data that leans to the weaker side and it's not surprising that the market is off a little bit."
Industrial and drilling companies were among the biggest decliners.
Transocean slid the most among stocks in the S&P 500, shedding 47 cents, or 4.5 percent, to $9.90. Steel products manufacturer Nucor fell $1.66, or 3.2 percent, to $50.69, while Alcoa slipped 25 cents, or 2.4 percent, to $10.17.
Oil prices added to recent gains.
Benchmark U.S. crude was rose $1, or 2.3 percent, to close at $44.49 a barrel in New York. Brent crude, used to price international oils, added 93 cents, or 2 percent, to close at $46.97 a barrel in London.
In other energy trading, wholesale gasoline added a penny to $1.37 a gallon, while heating oil rose 2 cents to $1.41 a gallon. Natural gas gained 3 cents to $2.58 per 1,000 cubic feet.
The major stock indexes in Europe mostly closed lower. The DAX index in Germany fell 0.3 percent, while France's CAC 40 was slid 0.1 percent. Britain's FTSE was flat.
Earlier in Asia, the Shanghai Composite index added 1.6 percent, while Hong Kong's Hang Seng gained 0.8 percent after China reported retail sales and factory output increased sharply in July from a year earlier, even as they declined from June 2016's levels. Elsewhere in the region, Japan's Nikkei 225 stock index rose 1.1 percent, while Australia's S&P/ASX 200 rose 0.4 percent. India's Sensex gained 1 percent. Markets in Southeast Asia were mostly higher.
Gold and other precious metals declined. Gold slid $6.70, or 0.5 percent, to $1,335.80 an ounce. Silver lost 32 cents, or 1.6 percent, to $19.70 an ounce. Copper fell 5 cents, or 2.3 percent, to $2.14 a pound.
Bond prices rose. The yield on the 10-year Treasury note fell to 1.51 percent from 1.56 late Thursday.
In currency markets, the dollar weakened to 101.27 yen from 101.93 on Thursday. The euro strengthened to $1.1164 from $1.1141.
Among other stocks that made big moves Friday:
--- Concordia International slumped 38.1 percent after the drugmaker reported disappointing sales, cut its annual forecasts and suspended its dividend. The stock shed $6.23 to $10.13.
--- Ruby Tuesday's slid 13.1 percent after the restaurant chain reported weak sales and said it would shutter 95 of its company-owned locations by September. The stock lost 49 cents to $3.24.
--- Silicon Graphics jumped 28.6 percent on news that Hewlett Packard Enterprise agreed to buy the computer equipment and services company for about $281 million. Silicon Graphics added $1.71 to $7.69.