Stocks rose on Wednesday as shares of McDonald's Corp and Procter & Gamble Co

advanced on positive broker comments, but profit-taking in financials and the Federal Reserve's cautious comments on the economy kept gains in check.

The Fed cut its 2009 forecast for gross domestic product and raised its unemployment rate outlook, tempering the recent optimism that the economy might be turning the corner.

But analysts said the Fed's revised outlook raised no new worries since the long-term forecast remained unchanged. Still, investors snapped up shares of companies they consider better able to withstand an uncertain economy.

McDonald's, up 5.4 percent to $56.80, was the biggest boost to the Dow, after Deutsche Bank recommended a buy on the fast-food chain, while Procter & Gamble Co, the maker of Tide laundry detergent and Pampers diapers, rose almost 3 percent to $54.46 after Barclays raised the stock to overweight.

I think everybody knows the worst-case scenarios for the economy are less likely and that we still have yet to see growth and when it comes, it'll probably be moderate, said David Bianco, chief U.S. equity strategist at UBS in New York.

The market has gotten to where it is because people have acknowledged those worst-case scenarios for the economy.

The Dow Jones industrial average <.DJI> rose 36.95 points, or 0.44 percent, to 8,511.80. The Standard & Poor's 500 Index <.SPX> gained 5.89 points, or 0.65 percent, to 914.02. The Nasdaq Composite Index <.IXIC> climbed 13.69 points, or 0.79 percent, to 1,748.23.

On Nasdaq shares of biotechnology companies, also considered defensive plays, were among the top boosts, with shares of Celgene Corp up 2.9 percent to $40.59 after Barclays upgraded the biotech sector, saying concerns on healthcare reform have been overdone.

After more than two months of leading the market higher, financial stocks reversed course as investors booked profits, sending Goldman Sachs down 2.5 percent to $137.54 and JPMorgan down 2.9 percent to $34.78. The KBW Bank index lost 2.2 percent.

The financials have had a huge move and financials continue to play a big part in overall market sentiment. As they've rolled over, the market has rolled over, said Michael James, senior trader at regional investment bank Wedbush Morgan in Los Angeles.

(Additional reporting by Ellis Mnyandu and Leah Schnurr, Editing by Leslie Adler)