The S&P 500 and Nasdaq closed marginally lower on Wednesday as President Barack Obama's $275 billion plan to prop up the housing market failed to stem worries about the economy, and bleak housing data highlighted the deepening recession.

Indexes see-sawed in a narrow range throughout the day, but the S&P and Nasdaq ultimately failed to hold gains despite bargain-hunting that sent investors to the perceived safety of defensive stocks, such as technology and consumer staples.

The Dow eked out a gain, driven by defensive shares such as Wal-Mart Stores , keeping the index from breaking through the November 20 bear market low.

Adding to the somber mood, the Federal Reserve slashed its economic forecast for 2009 and several companies, including Deere & Co , posted dismal results. Deere fell almost 4 percent.

Record low housing starts and applications for building permits for January set the tone early, overshadowing Obama's plan pledging up to $275 billion to help families refinance their mortgages to stem foreclosures.

There aren't a lot of specifics, running into the same problem as you did with Geithner and his speech a week ago, said Al Goldman, chief market strategist at Wachovia Securities in St. Louis, speaking of the keenly awaited housing plan.

The biggest problem in the market, in my opinion, is a major lack of confidence and disappointment that the current administration really hasn't done anything yet about the toxic assets held by banks.

The Dow Jones industrial average <.DJI> added 3.03 points, or 0.04 percent, to 7,555.63. The Standard & Poor's 500 Index <.SPX> was off 0.75 points, or 0.10 percent, to 788.42. The Nasdaq Composite Index <.IXIC> edged down 2.69 points, or 0.18 percent, at 1,467.97.

Since the beginning of the year, the broad S&P 500 is down close to 13 percent; after having risen 20 percent from the late November lows, it is now up almost 5 percent from that mark. Tuesday's sharp drop took indexes closer to the bear market lows and prompted some bargain-hunting on Wednesday.

Caterpillar Inc ,the world's biggest maker of construction equipment, was the top drag on the Dow, down 1.9 percent to $28.44.

Shares of Deere & Co dropped 3.8 percent to $32.23 after the farm equipment maker posted a quarterly profit that missed forecasts and cut its outlook.

The dismal housing data pulled shares of home builders down, with the Dow Jones home construction index <.DJUSHB> shedding 5 percent. Luxury home builder Toll Brothers fell 4.1 percent to $17.16, while D.R. Horton declined 5.4 percent to $8.44.

On the upside, Wal-Mart Stores saw a second day of gains after Tuesday's better-than-expected earnings, sending the discount retailer up 3.7 percent at $50.00.

Losses on the Nasdaq were cushioned as investors snapped up shares of big cap technology companies, which are seen as having more wherewithal to withstand the economic downturn. Google was among the top boosts, up 3.1 percent at $353.11.

(Editing by Leslie Adler)