* Consumer confidence worse than expected, home prices dip
* Apple slides at open, then cuts losses
* Walgreen jumps after earnings
* Dow up 0.3 pct, S&P up 0.2 pct, Nasdaq flat (Updates to late afternoon trade; changes byline)
By Angela Moon
NEW YORK, Sept 28 (Reuters) - The Dow and the S&P 500 edged up on Tuesday as corporate deal news and earnings expectations continued to fuel investor optimism.
Wall Street had opened lower after weak data on the state of consumer and the housing sector, but investors quickly brushed off the bad news.
"When a month takes you by a surprise like this, you tend to be underexposed to stocks and overexposed in cash and bonds. And as the quarter comes to an end, people are rushing to at least have ownership of the stocks that have performed well and have good outlook. That's causing the aggressiveness in the market," said Marc Pado, U.S. market strategist at Cantor Fitzgerald & Co in San Francisco.
The S&P 500 has risen about 9 percent so far in September, a month that is historically regarded as being the worst month for stocks. The Nasdaq has climbed about 13 percent.
The Dow Jones industrial average gained 32.28 points, or 0.30 percent, to 10,844.32. The Standard & Poor's 500 rose 2.40 points, or 0.21 percent, to 1,144.56. The Nasdaq Composite added 0.64 of a point, or 0.03 percent, to 2,370.30.
Walgreen Co, the biggest U.S. drugstore chain, reported higher-than-expected quarterly earnings, helped by strong prescription drug sales. Its shares jumped 11.1 percent to $33.71.
Continuing the spurt of recent M&A activity, Endo Pharmaceuticals Holdings Inc will buy private generics maker Qualitest Pharmaceuticals for about $1.2 billion, marking its second deal in as many months. Endo shares advanced 8.2 percent to $33.11.
Shares of Apple Inc slid as much as 5.6 percent on rumors its No. 2 executive was departing for Hewlett-Packard Co, but the stock recovered as analysts dismissed the speculation.
Representatives from Apple and Hewlett-Packard declined to comment. Apple shares shed 1.4 percent to $287.05 and HP rose 1.1 percent to $41.72.
September data showed U.S. consumer confidence fell to its lowest level since February, underscoring lingering worries about the strength of the economic recovery, while home prices dipped in July.
"Consumer confidence numbers are a reflection of news that we already know. It's now all about how companies will be performing next quarter," Pado said.
In the options market, traders were expecting heightened volatility as the third quarter comes to an end.
Scott Fullman, director of derivative investment strategy at WJB Capital Group, said there is a lot of money still on the sidelines. (Reporting by Angela Moon; Additional reporting by Doris Frankel; Editing by Jan Paschal)