NEW YORK (Reuters) - U.S. stocks ended higher after a choppy day on Wednesday as energy and technology gains countered a drop in healthcare stocks after President-elect Donald Trump said pharmaceutical companies were “getting away with murder” by charging high prices.

The Nasdaq ended the day with another record closing high after falling as much as 0.5 percent after Trump’s first formal news conference since the Nov. 8 election.

The S&P 500 healthcare index .SPXHC ended the session down 1 percent after falling as much as 1.9 percent earlier in the day and the Nasdaq biotechnology index .NBI sank 2.96 percent, ending a six-day winning streak for both indexes.

"When somebody that high profile says something that negative, people do not want to invest in it. They view the sector as uninvestible, and withdraw their money," Brad Loncar, manager of the Loncar Cancer Immunotherapy ETF CNCR.O.

However, the sector’s pain eased as the session wore on as money managers noted that Trump gave no new specific details on his healthcare proposals, according to Michael Scanlon, portfolio manager at Manulife Asset Management in Boston.

He cited the beginning of fourth-quarter earnings season on Friday and Trump’s inauguration as President on Jan. 20 as reasons for investor caution.

“Portfolio managers have every reason in the world to sit on their hands,” said Scanlon. “You put those two factors together and I don’t think you’re going to see much movement in the market until maybe we get some fireworks on Friday with earnings.”

The Dow Jones Industrial Average .DJI closed up 98.75 points, or 0.5 percent, to 19,954.28, the S&P 500 .SPX gained 6.42 points, or 0.28 percent, to 2,275.32 and the Nasdaq Composite .IXIC added 11.83 points, or 0.21 percent, to 5,563.65.Eight of the 11 major S&P sectors ended the day higher. Energy stocks .SPNY, ended 1.2 percent higher as crude oil CLc1LCOc1 prices rose.

The S&P's technology index .SPLRCT ended up 0.7 percent, boosted most by Microsoft Corp MSFT.O, Facebook Inc FB.O and Apple Inc AAPL.O.

The biggest drag on the S&P's healthcare sector was Bristol-Meyers Squibb's BMY.N with a 5.3 percent decline, after news that Merck & Co. leapfrogged its rivals in the race to combine immunotherapy with other drugs as a treatment for lung cancer. The next-biggest weights on the sector included Johnson & Johnson JNJ.N, with a 1.2 percent drop and Abbvie ABBV.N with a 3.6 percent decline.

Advancing issues outnumbered declining ones on the NYSE by a 2.20-to-1 ratio; on Nasdaq, a 1.22-to-1 ratio favored advancers.

The S&P 500 posted 20 new 52-week highs and two new lows; the Nasdaq Composite recorded 99 new highs and 18 new lows.

About 7.2 billion shares changed hands on U.S. exchanges on Wednesday compared with the 6.57 billion average for the last 20 sessions.