U.S. stocks were mixed on Wednesday after Goldman Sachs Group forecast a recession in 2008 erasing gains from health care and consumer companies.

Investors bought defensive stocks including drug makers such as Merck & Co and Pfizer Inc and those of consumer staple companies such as Altria Group Inc parent of cigarette maker Philip Morris. Healthcare stocks rallied after Goldman analysts said some drug makers will continue to grow earnings even as the economy slows. DuPont Co., the third-biggest U.S. chemical maker, jumped the most since October 2002.

Stocks ended down after Tuesday's trading with the Standard & Poor's 500 dropping the most since March leaving technology stocks worst hit. Hewlett-Packard, the biggest personal computer maker, helped push technology companies higher for the first time in seven days

The Standard & Poor's 500 Index dropped 0.21 or 0.2 percent, to 1,389.98 as of 12:20 p.m. in New York. The Dow Jones Industrial Average climbed 16.26, or 0.13 percent, to 12,605.33. The Nasdaq Composite Index decreased 1.84, or 0.8 percent, to 2,458.67.

On the Nasdaq, shares of Apple - the maker of the iPod and the iPhone - jumped 0.3 percent to $171.76, while Intel shares gained 2 percent to $22.70.